{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module Language.Dickinson.Type ( Dickinson (..)
, Declaration (..)
, Import (..)
, Expression (..)
, Pattern (..)
, DickinsonTy (..)
, defExprM
) where
import Control.DeepSeq (NFData)
import Data.Binary (Binary)
import Data.Data (Data)
import Data.Foldable (toList)
import Data.List.NonEmpty (NonEmpty (..))
import qualified Data.List.NonEmpty as NE
import Data.Semigroup ((<>))
import qualified Data.Text as T
import Data.Text.Prettyprint.Doc.Ext (Debug (..), hardSep, (<#*>), (<#>), (<^>))
import GHC.Generics (Generic)
import Language.Dickinson.Lexer
import Language.Dickinson.Name
import Prettyprinter (Doc, Pretty (pretty), align, brackets, colon, concatWith, dquotes, encloseSep, group, hardline, hsep, indent,
line, lparen, parens, pipe, rangle, rparen, tupled, vsep, (<+>))
import Prettyprinter.Internal (unsafeTextWithoutNewlines)
data Dickinson a = Dickinson { forall a. Dickinson a -> [Import a]
modImports :: [Import a]
, forall a. Dickinson a -> [Declaration a]
modDefs :: [Declaration a]
} deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Dickinson a) x -> Dickinson a
forall a x. Dickinson a -> Rep (Dickinson a) x
$cto :: forall a x. Rep (Dickinson a) x -> Dickinson a
$cfrom :: forall a x. Dickinson a -> Rep (Dickinson a) x
Generic, forall a. NFData a => Dickinson a -> ()
forall a. (a -> ()) -> NFData a
rnf :: Dickinson a -> ()
$crnf :: forall a. NFData a => Dickinson a -> ()
NFData, forall a. Binary a => Get (Dickinson a)
forall a. Binary a => [Dickinson a] -> Put
forall a. Binary a => Dickinson a -> Put
forall t. (t -> Put) -> Get t -> ([t] -> Put) -> Binary t
putList :: [Dickinson a] -> Put
$cputList :: forall a. Binary a => [Dickinson a] -> Put
get :: Get (Dickinson a)
$cget :: forall a. Binary a => Get (Dickinson a)
put :: Dickinson a -> Put
$cput :: forall a. Binary a => Dickinson a -> Put
Binary, forall a b. a -> Dickinson b -> Dickinson a
forall a b. (a -> b) -> Dickinson a -> Dickinson b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Dickinson b -> Dickinson a
$c<$ :: forall a b. a -> Dickinson b -> Dickinson a
fmap :: forall a b. (a -> b) -> Dickinson a -> Dickinson b
$cfmap :: forall a b. (a -> b) -> Dickinson a -> Dickinson b
Functor, Int -> Dickinson a -> ShowS
forall a. Show a => Int -> Dickinson a -> ShowS
forall a. Show a => [Dickinson a] -> ShowS
forall a. Show a => Dickinson a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Dickinson a] -> ShowS
$cshowList :: forall a. Show a => [Dickinson a] -> ShowS
show :: Dickinson a -> String
$cshow :: forall a. Show a => Dickinson a -> String
showsPrec :: Int -> Dickinson a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Dickinson a -> ShowS
Show)
data Declaration a = Define { forall a. Declaration a -> a
declAnn :: a
, forall a. Declaration a -> Name a
defName :: Name a
, forall a. Declaration a -> Expression a
defExpr :: Expression a
}
| TyDecl { declAnn :: a
, forall a. Declaration a -> Name a
tyName :: Name a
, forall a. Declaration a -> NonEmpty (Name a)
tyCons :: NonEmpty (TyName a)
}
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Declaration a) x -> Declaration a
forall a x. Declaration a -> Rep (Declaration a) x
$cto :: forall a x. Rep (Declaration a) x -> Declaration a
$cfrom :: forall a x. Declaration a -> Rep (Declaration a) x
Generic, forall a. NFData a => Declaration a -> ()
forall a. (a -> ()) -> NFData a
rnf :: Declaration a -> ()
$crnf :: forall a. NFData a => Declaration a -> ()
NFData, forall a. Binary a => Get (Declaration a)
forall a. Binary a => [Declaration a] -> Put
forall a. Binary a => Declaration a -> Put
forall t. (t -> Put) -> Get t -> ([t] -> Put) -> Binary t
putList :: [Declaration a] -> Put
$cputList :: forall a. Binary a => [Declaration a] -> Put
get :: Get (Declaration a)
$cget :: forall a. Binary a => Get (Declaration a)
put :: Declaration a -> Put
$cput :: forall a. Binary a => Declaration a -> Put
Binary, forall a b. a -> Declaration b -> Declaration a
forall a b. (a -> b) -> Declaration a -> Declaration b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Declaration b -> Declaration a
$c<$ :: forall a b. a -> Declaration b -> Declaration a
fmap :: forall a b. (a -> b) -> Declaration a -> Declaration b
$cfmap :: forall a b. (a -> b) -> Declaration a -> Declaration b
Functor, Int -> Declaration a -> ShowS
forall a. Show a => Int -> Declaration a -> ShowS
forall a. Show a => [Declaration a] -> ShowS
forall a. Show a => Declaration a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Declaration a] -> ShowS
$cshowList :: forall a. Show a => [Declaration a] -> ShowS
show :: Declaration a -> String
$cshow :: forall a. Show a => Declaration a -> String
showsPrec :: Int -> Declaration a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Declaration a -> ShowS
Show, Declaration a -> DataType
Declaration a -> Constr
forall {a}. Data a => Typeable (Declaration a)
forall a. Data a => Declaration a -> DataType
forall a. Data a => Declaration a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Declaration a -> Declaration a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Declaration a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Declaration a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> Declaration a -> m (Declaration a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Declaration a -> m (Declaration a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Declaration a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Declaration a -> c (Declaration a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Declaration a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Declaration a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Declaration a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Declaration a -> c (Declaration a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Declaration a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> Declaration a -> m (Declaration a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Declaration a -> m (Declaration a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> Declaration a -> m (Declaration a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> Declaration a -> m (Declaration a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> Declaration a -> m (Declaration a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> Declaration a -> m (Declaration a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Declaration a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Declaration a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Declaration a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Declaration a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Declaration a -> r
gmapT :: (forall b. Data b => b -> b) -> Declaration a -> Declaration a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Declaration a -> Declaration a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Declaration a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Declaration a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Declaration a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Declaration a))
dataTypeOf :: Declaration a -> DataType
$cdataTypeOf :: forall a. Data a => Declaration a -> DataType
toConstr :: Declaration a -> Constr
$ctoConstr :: forall a. Data a => Declaration a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Declaration a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Declaration a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Declaration a -> c (Declaration a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Declaration a -> c (Declaration a)
Data)
data Import a = Import { forall a. Import a -> a
importAnn :: a
, forall a. Import a -> Name a
declMod :: Name a
}
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Import a) x -> Import a
forall a x. Import a -> Rep (Import a) x
$cto :: forall a x. Rep (Import a) x -> Import a
$cfrom :: forall a x. Import a -> Rep (Import a) x
Generic, forall a. NFData a => Import a -> ()
forall a. (a -> ()) -> NFData a
rnf :: Import a -> ()
$crnf :: forall a. NFData a => Import a -> ()
NFData, forall a. Binary a => Get (Import a)
forall a. Binary a => [Import a] -> Put
forall a. Binary a => Import a -> Put
forall t. (t -> Put) -> Get t -> ([t] -> Put) -> Binary t
putList :: [Import a] -> Put
$cputList :: forall a. Binary a => [Import a] -> Put
get :: Get (Import a)
$cget :: forall a. Binary a => Get (Import a)
put :: Import a -> Put
$cput :: forall a. Binary a => Import a -> Put
Binary, forall a b. a -> Import b -> Import a
forall a b. (a -> b) -> Import a -> Import b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Import b -> Import a
$c<$ :: forall a b. a -> Import b -> Import a
fmap :: forall a b. (a -> b) -> Import a -> Import b
$cfmap :: forall a b. (a -> b) -> Import a -> Import b
Functor, Int -> Import a -> ShowS
forall a. Show a => Int -> Import a -> ShowS
forall a. Show a => [Import a] -> ShowS
forall a. Show a => Import a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Import a] -> ShowS
$cshowList :: forall a. Show a => [Import a] -> ShowS
show :: Import a -> String
$cshow :: forall a. Show a => Import a -> String
showsPrec :: Int -> Import a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Import a -> ShowS
Show)
data Pattern a = PatternVar { forall a. Pattern a -> a
patAnn :: a, forall a. Pattern a -> Name a
patName :: Name a }
| PatternTuple { patAnn :: a, forall a. Pattern a -> NonEmpty (Pattern a)
patTup :: NonEmpty (Pattern a) }
| PatternCons { patAnn :: a, forall a. Pattern a -> Name a
patCons :: TyName a }
| Wildcard { patAnn :: a }
| OrPattern { patAnn :: a, forall a. Pattern a -> NonEmpty (Pattern a)
patOr :: NonEmpty (Pattern a) }
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Pattern a) x -> Pattern a
forall a x. Pattern a -> Rep (Pattern a) x
$cto :: forall a x. Rep (Pattern a) x -> Pattern a
$cfrom :: forall a x. Pattern a -> Rep (Pattern a) x
Generic, forall a. NFData a => Pattern a -> ()
forall a. (a -> ()) -> NFData a
rnf :: Pattern a -> ()
$crnf :: forall a. NFData a => Pattern a -> ()
NFData, forall a. Binary a => Get (Pattern a)
forall a. Binary a => [Pattern a] -> Put
forall a. Binary a => Pattern a -> Put
forall t. (t -> Put) -> Get t -> ([t] -> Put) -> Binary t
putList :: [Pattern a] -> Put
$cputList :: forall a. Binary a => [Pattern a] -> Put
get :: Get (Pattern a)
$cget :: forall a. Binary a => Get (Pattern a)
put :: Pattern a -> Put
$cput :: forall a. Binary a => Pattern a -> Put
Binary, forall a b. a -> Pattern b -> Pattern a
forall a b. (a -> b) -> Pattern a -> Pattern b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Pattern b -> Pattern a
$c<$ :: forall a b. a -> Pattern b -> Pattern a
fmap :: forall a b. (a -> b) -> Pattern a -> Pattern b
$cfmap :: forall a b. (a -> b) -> Pattern a -> Pattern b
Functor, Pattern a -> Pattern a -> Bool
forall a. Eq a => Pattern a -> Pattern a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Pattern a -> Pattern a -> Bool
$c/= :: forall a. Eq a => Pattern a -> Pattern a -> Bool
== :: Pattern a -> Pattern a -> Bool
$c== :: forall a. Eq a => Pattern a -> Pattern a -> Bool
Eq, Int -> Pattern a -> ShowS
forall a. Show a => Int -> Pattern a -> ShowS
forall a. Show a => [Pattern a] -> ShowS
forall a. Show a => Pattern a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Pattern a] -> ShowS
$cshowList :: forall a. Show a => [Pattern a] -> ShowS
show :: Pattern a -> String
$cshow :: forall a. Show a => Pattern a -> String
showsPrec :: Int -> Pattern a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Pattern a -> ShowS
Show, Pattern a -> DataType
Pattern a -> Constr
forall {a}. Data a => Typeable (Pattern a)
forall a. Data a => Pattern a -> DataType
forall a. Data a => Pattern a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Pattern a -> Pattern a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Pattern a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Pattern a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Pattern a -> m (Pattern a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pattern a -> m (Pattern a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern a -> c (Pattern a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Pattern a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Pattern a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern a -> c (Pattern a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Pattern a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pattern a -> m (Pattern a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pattern a -> m (Pattern a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Pattern a -> m (Pattern a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Pattern a -> m (Pattern a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Pattern a -> m (Pattern a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Pattern a -> m (Pattern a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Pattern a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Pattern a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Pattern a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Pattern a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Pattern a -> r
gmapT :: (forall b. Data b => b -> b) -> Pattern a -> Pattern a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Pattern a -> Pattern a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Pattern a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Pattern a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Pattern a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Pattern a))
dataTypeOf :: Pattern a -> DataType
$cdataTypeOf :: forall a. Data a => Pattern a -> DataType
toConstr :: Pattern a -> Constr
$ctoConstr :: forall a. Data a => Pattern a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Pattern a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern a -> c (Pattern a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Pattern a -> c (Pattern a)
Data)
data Expression a = Literal { forall a. Expression a -> a
exprAnn :: a, forall a. Expression a -> Text
litText :: T.Text }
| StrChunk { exprAnn :: a, forall a. Expression a -> Text
chunkText :: T.Text }
| Choice { exprAnn :: a
, forall a. Expression a -> NonEmpty (Double, Expression a)
choices :: NonEmpty (Double, Expression a)
}
| Let { exprAnn :: a
, forall a. Expression a -> NonEmpty (Name a, Expression a)
letBinds :: NonEmpty (Name a, Expression a)
, forall a. Expression a -> Expression a
letExpr :: Expression a
}
| Bind { exprAnn :: a
, letBinds :: NonEmpty (Name a, Expression a)
, letExpr :: Expression a
}
| Var { exprAnn :: a, forall a. Expression a -> Name a
exprVar :: Name a }
| Interp { exprAnn :: a, forall a. Expression a -> [Expression a]
exprInterp :: [Expression a] }
| MultiInterp { exprAnn :: a, forall a. Expression a -> [Expression a]
exprMultiInterp :: [Expression a] }
| Lambda { exprAnn :: a
, forall a. Expression a -> Name a
lambdaVar :: Name a
, forall a. Expression a -> DickinsonTy a
lambdaTy :: DickinsonTy a
, forall a. Expression a -> Expression a
lambdaExpr :: Expression a
}
| Apply { exprAnn :: a
, forall a. Expression a -> Expression a
exprFun :: Expression a
, forall a. Expression a -> Expression a
exprArg :: Expression a
}
| Concat { exprAnn :: a, forall a. Expression a -> [Expression a]
exprConcats :: [Expression a] }
| Tuple { exprAnn :: a, forall a. Expression a -> NonEmpty (Expression a)
exprTup :: NonEmpty (Expression a) }
| Match { exprAnn :: a
, forall a. Expression a -> Expression a
exprMatch :: Expression a
, forall a. Expression a -> NonEmpty (Pattern a, Expression a)
exprBranch :: NonEmpty (Pattern a, Expression a)
}
| Flatten { exprAnn :: a, forall a. Expression a -> Expression a
exprFlat :: Expression a }
| Annot { exprAnn :: a
, forall a. Expression a -> Expression a
expr :: Expression a
, forall a. Expression a -> DickinsonTy a
exprTy :: DickinsonTy a
}
| Constructor { exprAnn :: a, forall a. Expression a -> Name a
constructorName :: TyName a }
| BuiltinFn { exprAnn :: a, forall a. Expression a -> Builtin
exprBuiltin :: Builtin }
| Random { exprAnn :: a, forall a. Expression a -> Name a
tySelName :: Name a }
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Expression a) x -> Expression a
forall a x. Expression a -> Rep (Expression a) x
$cto :: forall a x. Rep (Expression a) x -> Expression a
$cfrom :: forall a x. Expression a -> Rep (Expression a) x
Generic, forall a. NFData a => Expression a -> ()
forall a. (a -> ()) -> NFData a
rnf :: Expression a -> ()
$crnf :: forall a. NFData a => Expression a -> ()
NFData, forall a. Binary a => Get (Expression a)
forall a. Binary a => [Expression a] -> Put
forall a. Binary a => Expression a -> Put
forall t. (t -> Put) -> Get t -> ([t] -> Put) -> Binary t
putList :: [Expression a] -> Put
$cputList :: forall a. Binary a => [Expression a] -> Put
get :: Get (Expression a)
$cget :: forall a. Binary a => Get (Expression a)
put :: Expression a -> Put
$cput :: forall a. Binary a => Expression a -> Put
Binary, forall a b. a -> Expression b -> Expression a
forall a b. (a -> b) -> Expression a -> Expression b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Expression b -> Expression a
$c<$ :: forall a b. a -> Expression b -> Expression a
fmap :: forall a b. (a -> b) -> Expression a -> Expression b
$cfmap :: forall a b. (a -> b) -> Expression a -> Expression b
Functor, Int -> Expression a -> ShowS
forall a. Show a => Int -> Expression a -> ShowS
forall a. Show a => [Expression a] -> ShowS
forall a. Show a => Expression a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Expression a] -> ShowS
$cshowList :: forall a. Show a => [Expression a] -> ShowS
show :: Expression a -> String
$cshow :: forall a. Show a => Expression a -> String
showsPrec :: Int -> Expression a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Expression a -> ShowS
Show, Expression a -> DataType
Expression a -> Constr
forall {a}. Data a => Typeable (Expression a)
forall a. Data a => Expression a -> DataType
forall a. Data a => Expression a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Expression a -> Expression a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Expression a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Expression a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Expression a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Expression a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Expression a -> m (Expression a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Expression a -> m (Expression a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Expression a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Expression a -> c (Expression a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Expression a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Expression a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Expression a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Expression a -> c (Expression a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Expression a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Expression a -> m (Expression a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Expression a -> m (Expression a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Expression a -> m (Expression a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Expression a -> m (Expression a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Expression a -> m (Expression a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Expression a -> m (Expression a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Expression a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> Expression a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Expression a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Expression a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Expression a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Expression a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Expression a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Expression a -> r
gmapT :: (forall b. Data b => b -> b) -> Expression a -> Expression a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Expression a -> Expression a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Expression a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Expression a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Expression a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Expression a))
dataTypeOf :: Expression a -> DataType
$cdataTypeOf :: forall a. Data a => Expression a -> DataType
toConstr :: Expression a -> Constr
$ctoConstr :: forall a. Data a => Expression a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Expression a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Expression a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Expression a -> c (Expression a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Expression a -> c (Expression a)
Data)
data DickinsonTy a = TyText a
| TyFun a (DickinsonTy a) (DickinsonTy a)
| TyTuple a (NonEmpty (DickinsonTy a))
| TyNamed a (Name a)
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (DickinsonTy a) x -> DickinsonTy a
forall a x. DickinsonTy a -> Rep (DickinsonTy a) x
$cto :: forall a x. Rep (DickinsonTy a) x -> DickinsonTy a
$cfrom :: forall a x. DickinsonTy a -> Rep (DickinsonTy a) x
Generic, forall a. NFData a => DickinsonTy a -> ()
forall a. (a -> ()) -> NFData a
rnf :: DickinsonTy a -> ()
$crnf :: forall a. NFData a => DickinsonTy a -> ()
NFData, forall a. Binary a => Get (DickinsonTy a)
forall a. Binary a => [DickinsonTy a] -> Put
forall a. Binary a => DickinsonTy a -> Put
forall t. (t -> Put) -> Get t -> ([t] -> Put) -> Binary t
putList :: [DickinsonTy a] -> Put
$cputList :: forall a. Binary a => [DickinsonTy a] -> Put
get :: Get (DickinsonTy a)
$cget :: forall a. Binary a => Get (DickinsonTy a)
put :: DickinsonTy a -> Put
$cput :: forall a. Binary a => DickinsonTy a -> Put
Binary, Int -> DickinsonTy a -> ShowS
forall a. Show a => Int -> DickinsonTy a -> ShowS
forall a. Show a => [DickinsonTy a] -> ShowS
forall a. Show a => DickinsonTy a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DickinsonTy a] -> ShowS
$cshowList :: forall a. Show a => [DickinsonTy a] -> ShowS
show :: DickinsonTy a -> String
$cshow :: forall a. Show a => DickinsonTy a -> String
showsPrec :: Int -> DickinsonTy a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> DickinsonTy a -> ShowS
Show, forall a b. a -> DickinsonTy b -> DickinsonTy a
forall a b. (a -> b) -> DickinsonTy a -> DickinsonTy b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> DickinsonTy b -> DickinsonTy a
$c<$ :: forall a b. a -> DickinsonTy b -> DickinsonTy a
fmap :: forall a b. (a -> b) -> DickinsonTy a -> DickinsonTy b
$cfmap :: forall a b. (a -> b) -> DickinsonTy a -> DickinsonTy b
Functor, DickinsonTy a -> DataType
DickinsonTy a -> Constr
forall {a}. Data a => Typeable (DickinsonTy a)
forall a. Data a => DickinsonTy a -> DataType
forall a. Data a => DickinsonTy a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> DickinsonTy a -> DickinsonTy a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> DickinsonTy a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> DickinsonTy a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DickinsonTy a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DickinsonTy a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> DickinsonTy a -> m (DickinsonTy a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> DickinsonTy a -> m (DickinsonTy a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (DickinsonTy a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DickinsonTy a -> c (DickinsonTy a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (DickinsonTy a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (DickinsonTy a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (DickinsonTy a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DickinsonTy a -> c (DickinsonTy a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (DickinsonTy a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DickinsonTy a -> m (DickinsonTy a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> DickinsonTy a -> m (DickinsonTy a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> DickinsonTy a -> m (DickinsonTy a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> DickinsonTy a -> m (DickinsonTy a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> DickinsonTy a -> m (DickinsonTy a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> DickinsonTy a -> m (DickinsonTy a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DickinsonTy a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> DickinsonTy a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> DickinsonTy a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> DickinsonTy a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DickinsonTy a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DickinsonTy a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DickinsonTy a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DickinsonTy a -> r
gmapT :: (forall b. Data b => b -> b) -> DickinsonTy a -> DickinsonTy a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> DickinsonTy a -> DickinsonTy a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (DickinsonTy a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (DickinsonTy a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (DickinsonTy a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (DickinsonTy a))
dataTypeOf :: DickinsonTy a -> DataType
$cdataTypeOf :: forall a. Data a => DickinsonTy a -> DataType
toConstr :: DickinsonTy a -> Constr
$ctoConstr :: forall a. Data a => DickinsonTy a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (DickinsonTy a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (DickinsonTy a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DickinsonTy a -> c (DickinsonTy a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DickinsonTy a -> c (DickinsonTy a)
Data)
instance Eq (DickinsonTy a) where
== :: DickinsonTy a -> DickinsonTy a -> Bool
(==) TyText{} TyText{} = Bool
True
(==) (TyFun a
_ DickinsonTy a
ty DickinsonTy a
ty') (TyFun a
_ DickinsonTy a
ty'' DickinsonTy a
ty''') = (DickinsonTy a
ty forall a. Eq a => a -> a -> Bool
== DickinsonTy a
ty'') Bool -> Bool -> Bool
&& (DickinsonTy a
ty' forall a. Eq a => a -> a -> Bool
== DickinsonTy a
ty''')
(==) (TyTuple a
_ NonEmpty (DickinsonTy a)
tys) (TyTuple a
_ NonEmpty (DickinsonTy a)
tys') = forall (t :: * -> *). Foldable t => t Bool -> Bool
and (forall a b c.
(a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c
NE.zipWith forall a. Eq a => a -> a -> Bool
(==) NonEmpty (DickinsonTy a)
tys NonEmpty (DickinsonTy a)
tys')
(==) (TyNamed a
_ Name a
n) (TyNamed a
_ Name a
n') = Name a
n forall a. Eq a => a -> a -> Bool
== Name a
n'
(==) DickinsonTy a
_ DickinsonTy a
_ = Bool
False
instance Pretty (Declaration a) where
pretty :: forall ann. Declaration a -> Doc ann
pretty (Define a
_ Name a
n Expression a
e) = forall ann. Doc ann -> Doc ann
parens (Doc ann
":def" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Name a
n forall ann. Doc ann -> Doc ann -> Doc ann
<#> forall ann. Int -> Doc ann -> Doc ann
indent Int
2 (forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e))
pretty (TyDecl a
_ Name a
n NonEmpty (Name a)
cs) = Doc ann
"tydecl" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Name a
n forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall ann. Doc ann -> Doc ann
align (Doc ann
"=" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall ann. Doc ann -> Doc ann
group (forall (t :: * -> *) ann.
Foldable t =>
(Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann
concatWith (\Doc ann
x Doc ann
y -> Doc ann
x forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
line forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
pipe forall ann. Doc ann -> Doc ann -> Doc ann
<+> Doc ann
y) (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (forall a ann. Pretty a => a -> Doc ann
pretty forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Name a)
cs))))
instance Pretty (Import a) where
pretty :: forall ann. Import a -> Doc ann
pretty = forall a b. (Name a -> Doc b) -> Import a -> Doc b
prettyImport forall a ann. Pretty a => a -> Doc ann
pretty
prettyImport :: (Name a -> Doc b) -> Import a -> Doc b
prettyImport :: forall a b. (Name a -> Doc b) -> Import a -> Doc b
prettyImport Name a -> Doc b
pn (Import a
_ Name a
n) = forall ann. Doc ann -> Doc ann
parens (Doc b
":include" forall ann. Doc ann -> Doc ann -> Doc ann
<+> Name a -> Doc b
pn Name a
n)
instance Pretty (Dickinson a) where
pretty :: forall ann. Dickinson a -> Doc ann
pretty (Dickinson [] [Declaration a]
ds) =
Doc ann
"%-"
forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline
forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline
forall a. Semigroup a => a -> a -> a
<> forall (t :: * -> *) ann.
Foldable t =>
(Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann
concatWith (\Doc ann
x Doc ann
y -> Doc ann
x forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline forall a. Semigroup a => a -> a -> a
<> Doc ann
y) (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a ann. Pretty a => a -> Doc ann
pretty [Declaration a]
ds)
pretty (Dickinson [Import a]
is []) =
forall (t :: * -> *) ann.
Foldable t =>
(Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann
concatWith (\Doc ann
x Doc ann
y -> Doc ann
x forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline forall a. Semigroup a => a -> a -> a
<> Doc ann
y) (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a ann. Pretty a => a -> Doc ann
pretty [Import a]
is)
forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline
forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline
forall a. Semigroup a => a -> a -> a
<> Doc ann
"%-"
pretty (Dickinson [Import a]
is [Declaration a]
ds) =
forall (t :: * -> *) ann.
Foldable t =>
(Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann
concatWith (\Doc ann
x Doc ann
y -> Doc ann
x forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline forall a. Semigroup a => a -> a -> a
<> Doc ann
y) (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a ann. Pretty a => a -> Doc ann
pretty [Import a]
is)
forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline
forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline
forall a. Semigroup a => a -> a -> a
<> Doc ann
"%-"
forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline
forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline
forall a. Semigroup a => a -> a -> a
<> forall (t :: * -> *) ann.
Foldable t =>
(Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann
concatWith (\Doc ann
x Doc ann
y -> Doc ann
x forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline forall a. Semigroup a => a -> a -> a
<> forall ann. Doc ann
hardline forall a. Semigroup a => a -> a -> a
<> Doc ann
y) (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a ann. Pretty a => a -> Doc ann
pretty [Declaration a]
ds)
prettyLetLeaf :: Pretty t => (t, Expression a) -> Doc b
prettyLetLeaf :: forall t a b. Pretty t => (t, Expression a) -> Doc b
prettyLetLeaf (t
n, e :: Expression a
e@MultiInterp{}) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
brackets (forall a ann. Pretty a => a -> Doc ann
pretty t
n forall ann. Doc ann -> Doc ann -> Doc ann
<^> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e))
prettyLetLeaf (t
n, e :: Expression a
e@Choice{}) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
brackets (forall a ann. Pretty a => a -> Doc ann
pretty t
n forall ann. Doc ann -> Doc ann -> Doc ann
<^> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e))
prettyLetLeaf (t
n, Expression a
e) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
brackets (forall a ann. Pretty a => a -> Doc ann
pretty t
n forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e))
prettyChoiceBranch :: (Double, Expression a) -> Doc b
prettyChoiceBranch :: forall a b. (Double, Expression a) -> Doc b
prettyChoiceBranch (Double
d, Expression a
e) = forall ann. Doc ann -> Doc ann
parens (forall ann. Doc ann
pipe forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Double
d forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e)
prettyChoiceOneof :: Expression a -> Doc b
prettyChoiceOneof :: forall a b. Expression a -> Doc b
prettyChoiceOneof Expression a
e = forall ann. Doc ann -> Doc ann
parens (forall ann. Doc ann
pipe forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e)
prettyInterp :: Expression a -> Doc b
prettyInterp :: forall a b. Expression a -> Doc b
prettyInterp (StrChunk a
_ Text
t) = forall a ann. Pretty a => a -> Doc ann
pretty (Text -> Text
escReplace Text
t)
prettyInterp Expression a
e = Doc b
"${" forall a. Semigroup a => a -> a -> a
<> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e forall a. Semigroup a => a -> a -> a
<> Doc b
"}"
prettyMultiInterp :: [Expression a] -> Doc b
prettyMultiInterp :: forall a b. [Expression a] -> Doc b
prettyMultiInterp = forall a. Monoid a => [a] -> a
mconcat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. Expression a -> Doc b
prettyChunk
where prettyChunk :: Expression a -> Doc a
prettyChunk (StrChunk a
_ Text
t) = forall a. Text -> Doc a
textHard Text
t
prettyChunk Expression a
e = Doc a
"${" forall a. Semigroup a => a -> a -> a
<> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e forall a. Semigroup a => a -> a -> a
<> Doc a
"}"
textHard :: T.Text -> Doc a
textHard :: forall a. Text -> Doc a
textHard = forall (t :: * -> *) ann.
Foldable t =>
(Doc ann -> Doc ann -> Doc ann) -> t (Doc ann) -> Doc ann
concatWith forall ann. Doc ann -> Doc ann -> Doc ann
(<#>) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall a. Text -> Doc a
unsafeTextWithoutNewlines forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text -> [Text]
T.splitOn Text
"\n"
instance Pretty (Pattern a) where
pretty :: forall ann. Pattern a -> Doc ann
pretty = forall a b. (Name a -> Doc b) -> Pattern a -> Doc b
prettyPattern forall a ann. Pretty a => a -> Doc ann
pretty
instance Debug (Pattern a) where
debug :: forall b. Pattern a -> Doc b
debug = forall a b. (Name a -> Doc b) -> Pattern a -> Doc b
prettyPattern forall a b. Debug a => a -> Doc b
debug
prettyPattern :: (Name a -> Doc b) -> Pattern a -> Doc b
prettyPattern :: forall a b. (Name a -> Doc b) -> Pattern a -> Doc b
prettyPattern Name a -> Doc b
pn (PatternVar a
_ Name a
n) = Name a -> Doc b
pn Name a
n
prettyPattern Name a -> Doc b
pn (PatternTuple a
_ NonEmpty (Pattern a)
ps) = forall ann. [Doc ann] -> Doc ann
tupled (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (forall a b. (Name a -> Doc b) -> Pattern a -> Doc b
prettyPattern Name a -> Doc b
pn forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Pattern a)
ps))
prettyPattern Name a -> Doc b
_ Wildcard{} = Doc b
"_"
prettyPattern Name a -> Doc b
pn (PatternCons a
_ Name a
c) = Name a -> Doc b
pn Name a
c
prettyPattern Name a -> Doc b
pn (OrPattern a
_ NonEmpty (Pattern a)
ps) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann -> Doc ann -> [Doc ann] -> Doc ann
encloseSep forall ann. Doc ann
lparen forall ann. Doc ann
rparen forall ann. Doc ann
pipe (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall a b. (Name a -> Doc b) -> Pattern a -> Doc b
prettyPattern Name a -> Doc b
pn) NonEmpty (Pattern a)
ps))
escReplace :: T.Text -> T.Text
escReplace :: Text -> Text
escReplace =
Text -> Text -> Text -> Text
T.replace Text
"\"" Text
"\\\""
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text -> Text -> Text
T.replace Text
"\n" Text
"\\n"
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text -> Text -> Text
T.replace Text
"${" Text
"\\${"
allEq :: Eq a => NonEmpty a -> Bool
allEq :: forall a. Eq a => NonEmpty a -> Bool
allEq (a
x :| [a]
xs) = forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (forall a. Eq a => a -> a -> Bool
== a
x) [a]
xs
instance Pretty (Expression a) where
pretty :: forall ann. Expression a -> Doc ann
pretty (Var a
_ Name a
n) = forall a ann. Pretty a => a -> Doc ann
pretty Name a
n
pretty (Literal a
_ Text
l) = forall ann. Doc ann -> Doc ann
dquotes forall a b. (a -> b) -> a -> b
$ forall a ann. Pretty a => a -> Doc ann
pretty (Text -> Text
escReplace Text
l)
pretty (Let a
_ NonEmpty (Name a, Expression a)
ls Expression a
e) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
parens (Doc ann
":let" forall ann. Doc ann -> Doc ann -> Doc ann
<^> forall ann. [Doc ann] -> Doc ann
vsep (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall t a b. Pretty t => (t, Expression a) -> Doc b
prettyLetLeaf NonEmpty (Name a, Expression a)
ls) forall a. [a] -> [a] -> [a]
++ [forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e])))
pretty (Bind a
_ NonEmpty (Name a, Expression a)
ls Expression a
e) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
parens (Doc ann
":bind" forall ann. Doc ann -> Doc ann -> Doc ann
<^> forall ann. [Doc ann] -> Doc ann
vsep (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall t a b. Pretty t => (t, Expression a) -> Doc b
prettyLetLeaf NonEmpty (Name a, Expression a)
ls) forall a. [a] -> [a] -> [a]
++ [forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e])))
pretty (Choice a
_ NonEmpty (Double, Expression a)
brs)
| forall a. Eq a => NonEmpty a -> Bool
allEq (forall a b. (a, b) -> a
fst forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Double, Expression a)
brs) = forall ann. Doc ann -> Doc ann
parens (Doc ann
":oneof" forall ann. Doc ann -> Doc ann -> Doc ann
<#> forall ann. Int -> Doc ann -> Doc ann
indent Int
2 (forall ann. [Doc ann] -> Doc ann
hardSep (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. Expression a -> Doc b
prettyChoiceOneof (forall a b. (a, b) -> b
snd forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Double, Expression a)
brs))))
| Bool
otherwise = forall ann. Doc ann -> Doc ann
parens (Doc ann
":branch" forall ann. Doc ann -> Doc ann -> Doc ann
<#> forall ann. Int -> Doc ann -> Doc ann
indent Int
2 (forall ann. [Doc ann] -> Doc ann
hardSep (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a b. (Double, Expression a) -> Doc b
prettyChoiceBranch NonEmpty (Double, Expression a)
brs)))
pretty (Lambda a
_ Name a
n DickinsonTy a
ty Expression a
e) = forall ann. Doc ann -> Doc ann
parens (Doc ann
":lambda" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Name a
n forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty DickinsonTy a
ty forall ann. Doc ann -> Doc ann -> Doc ann
<#*> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e)
pretty (Apply a
_ Expression a
e e' :: Expression a
e'@Choice{}) = forall ann. Doc ann -> Doc ann
parens (Doc ann
"$" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e forall ann. Doc ann -> Doc ann -> Doc ann
<^> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e')
pretty (Apply a
_ Expression a
e Expression a
e') = forall ann. Doc ann -> Doc ann
parens (Doc ann
"$" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e')
pretty (Interp a
_ [Expression a]
es) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
dquotes (forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap forall a b. Expression a -> Doc b
prettyInterp [Expression a]
es))
pretty (MultiInterp a
_ [Expression a]
es) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
align (Doc ann
"'''" forall a. Semigroup a => a -> a -> a
<> forall a b. [Expression a] -> Doc b
prettyMultiInterp [Expression a]
es forall a. Semigroup a => a -> a -> a
<> Doc ann
"'''"))
pretty (Concat a
_ [Expression a]
es) = forall ann. Doc ann -> Doc ann
parens (forall ann. Doc ann
rangle forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall ann. [Doc ann] -> Doc ann
hsep (forall a ann. Pretty a => a -> Doc ann
pretty forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Expression a]
es))
pretty StrChunk{} = forall a. HasCallStack => String -> a
error String
"Internal error: naked StrChunk"
pretty (Tuple a
_ NonEmpty (Expression a)
es) = forall ann. [Doc ann] -> Doc ann
tupled (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (forall a ann. Pretty a => a -> Doc ann
pretty forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Expression a)
es))
pretty (Match a
_ Expression a
n NonEmpty (Pattern a, Expression a)
brs) = forall ann. Doc ann -> Doc ann
parens (Doc ann
":match" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
n forall ann. Doc ann -> Doc ann -> Doc ann
<^> forall ann. [Doc ann] -> Doc ann
vsep (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall t a b. Pretty t => (t, Expression a) -> Doc b
prettyLetLeaf NonEmpty (Pattern a, Expression a)
brs)))
pretty (Flatten a
_ Expression a
e) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
parens (Doc ann
":flatten" forall ann. Doc ann -> Doc ann -> Doc ann
<^> forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e))
pretty (Annot a
_ Expression a
e DickinsonTy a
ty) = forall a ann. Pretty a => a -> Doc ann
pretty Expression a
e forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall ann. Doc ann
colon forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty DickinsonTy a
ty
pretty (Constructor a
_ Name a
tn) = forall a ann. Pretty a => a -> Doc ann
pretty Name a
tn
pretty (BuiltinFn a
_ Builtin
b) = forall a ann. Pretty a => a -> Doc ann
pretty Builtin
b
pretty (Random a
_ Name a
tn) = forall ann. Doc ann -> Doc ann
group (forall ann. Doc ann -> Doc ann
parens (Doc ann
":pick" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a ann. Pretty a => a -> Doc ann
pretty Name a
tn))
instance Pretty (DickinsonTy a) where
pretty :: forall ann. DickinsonTy a -> Doc ann
pretty = forall a b. (Name a -> Doc b) -> DickinsonTy a -> Doc b
prettyType forall a ann. Pretty a => a -> Doc ann
pretty
prettyType :: (Name a -> Doc b) -> DickinsonTy a -> Doc b
prettyType :: forall a b. (Name a -> Doc b) -> DickinsonTy a -> Doc b
prettyType Name a -> Doc b
_ TyText{} = Doc b
"text"
prettyType Name a -> Doc b
pn (TyFun a
_ DickinsonTy a
t DickinsonTy a
t') = forall ann. Doc ann -> Doc ann
parens (Doc b
"⟶" forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a b. (Name a -> Doc b) -> DickinsonTy a -> Doc b
prettyType Name a -> Doc b
pn DickinsonTy a
t forall ann. Doc ann -> Doc ann -> Doc ann
<+> forall a b. (Name a -> Doc b) -> DickinsonTy a -> Doc b
prettyType Name a -> Doc b
pn DickinsonTy a
t')
prettyType Name a -> Doc b
pn (TyTuple a
_ NonEmpty (DickinsonTy a)
ts) = forall ann. [Doc ann] -> Doc ann
tupled (forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (forall a b. (Name a -> Doc b) -> DickinsonTy a -> Doc b
prettyType Name a -> Doc b
pn forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (DickinsonTy a)
ts))
prettyType Name a -> Doc b
pn (TyNamed a
_ Name a
n) = Name a -> Doc b
pn Name a
n
defExprM :: Declaration a -> Maybe (Expression a)
defExprM :: forall a. Declaration a -> Maybe (Expression a)
defExprM (Define a
_ Name a
_ Expression a
e) = forall a. a -> Maybe a
Just Expression a
e
defExprM TyDecl{} = forall a. Maybe a
Nothing