sslang-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Front.Ast

Description

Sslang abstract syntax tree.

Synopsis

Documentation

newtype Program Source #

A complete program: a list of top-level definitions.

Constructors

Program [TopDef] 

Instances

Instances details
Eq Program Source # 
Instance details

Defined in Front.Ast

Methods

(==) :: Program -> Program -> Bool #

(/=) :: Program -> Program -> Bool #

Data Program Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Program -> c Program #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Program #

toConstr :: Program -> Constr #

dataTypeOf :: Program -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Program) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Program) #

gmapT :: (forall b. Data b => b -> b) -> Program -> Program #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Program -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Program -> r #

gmapQ :: (forall d. Data d => d -> u) -> Program -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Program -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Program -> m Program #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Program -> m Program #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Program -> m Program #

Show Program Source # 
Instance details

Defined in Front.Ast

Pretty Program Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: Program -> Doc ann

prettyList :: [Program] -> Doc ann

Dumpy Program Source # 
Instance details

Defined in Front.Ast

Methods

dumpy :: Program -> Doc ann Source #

data TopDef Source #

A top-level definition.

Constructors

TopDef Definition

Bind a (data) value to a variable

TopType TypeDef

Define an algebraic data type

TopCDefs String

Inlined block of C definitions

TopExtern ExternDecl

Declare external symbol for FFI

Instances

Instances details
Eq TopDef Source # 
Instance details

Defined in Front.Ast

Methods

(==) :: TopDef -> TopDef -> Bool #

(/=) :: TopDef -> TopDef -> Bool #

Data TopDef Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TopDef -> c TopDef #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TopDef #

toConstr :: TopDef -> Constr #

dataTypeOf :: TopDef -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TopDef) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TopDef) #

gmapT :: (forall b. Data b => b -> b) -> TopDef -> TopDef #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TopDef -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TopDef -> r #

gmapQ :: (forall d. Data d => d -> u) -> TopDef -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TopDef -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TopDef -> m TopDef #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TopDef -> m TopDef #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TopDef -> m TopDef #

Show TopDef Source # 
Instance details

Defined in Front.Ast

Pretty TopDef Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: TopDef -> Doc ann

prettyList :: [TopDef] -> Doc ann

data ExternDecl Source #

Associate a type with a symbol

Constructors

ExternDecl Identifier Typ 

Instances

Instances details
Eq ExternDecl Source # 
Instance details

Defined in Front.Ast

Data ExternDecl Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ExternDecl -> c ExternDecl #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ExternDecl #

toConstr :: ExternDecl -> Constr #

dataTypeOf :: ExternDecl -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ExternDecl) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ExternDecl) #

gmapT :: (forall b. Data b => b -> b) -> ExternDecl -> ExternDecl #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ExternDecl -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ExternDecl -> r #

gmapQ :: (forall d. Data d => d -> u) -> ExternDecl -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ExternDecl -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ExternDecl -> m ExternDecl #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ExternDecl -> m ExternDecl #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ExternDecl -> m ExternDecl #

Show ExternDecl Source # 
Instance details

Defined in Front.Ast

Pretty ExternDecl Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: ExternDecl -> Doc ann

prettyList :: [ExternDecl] -> Doc ann

data TypeDef Source #

An algebraic data type definition.

Constructors

TypeDef 

Fields

Instances

Instances details
Eq TypeDef Source # 
Instance details

Defined in Front.Ast

Methods

(==) :: TypeDef -> TypeDef -> Bool #

(/=) :: TypeDef -> TypeDef -> Bool #

Data TypeDef Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TypeDef -> c TypeDef #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypeDef #

toConstr :: TypeDef -> Constr #

dataTypeOf :: TypeDef -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TypeDef) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeDef) #

gmapT :: (forall b. Data b => b -> b) -> TypeDef -> TypeDef #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypeDef -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypeDef -> r #

gmapQ :: (forall d. Data d => d -> u) -> TypeDef -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeDef -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypeDef -> m TypeDef #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeDef -> m TypeDef #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeDef -> m TypeDef #

Show TypeDef Source # 
Instance details

Defined in Front.Ast

Pretty TypeDef Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: TypeDef -> Doc ann

prettyList :: [TypeDef] -> Doc ann

data TypeVariant Source #

A type variant, i.e., a data constructor.

Constructors

VariantUnnamed Identifier [Typ] 

Instances

Instances details
Eq TypeVariant Source # 
Instance details

Defined in Front.Ast

Data TypeVariant Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TypeVariant -> c TypeVariant #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypeVariant #

toConstr :: TypeVariant -> Constr #

dataTypeOf :: TypeVariant -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TypeVariant) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeVariant) #

gmapT :: (forall b. Data b => b -> b) -> TypeVariant -> TypeVariant #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypeVariant -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypeVariant -> r #

gmapQ :: (forall d. Data d => d -> u) -> TypeVariant -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeVariant -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypeVariant -> m TypeVariant #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeVariant -> m TypeVariant #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeVariant -> m TypeVariant #

Show TypeVariant Source # 
Instance details

Defined in Front.Ast

Pretty TypeVariant Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: TypeVariant -> Doc ann

prettyList :: [TypeVariant] -> Doc ann

data Definition Source #

A value definition.

Instances

Instances details
Eq Definition Source # 
Instance details

Defined in Front.Ast

Data Definition Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Definition -> c Definition #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Definition #

toConstr :: Definition -> Constr #

dataTypeOf :: Definition -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Definition) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Definition) #

gmapT :: (forall b. Data b => b -> b) -> Definition -> Definition #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Definition -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Definition -> r #

gmapQ :: (forall d. Data d => d -> u) -> Definition -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Definition -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Definition -> m Definition #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Definition -> m Definition #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Definition -> m Definition #

Show Definition Source # 
Instance details

Defined in Front.Ast

Pretty Definition Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: Definition -> Doc ann

prettyList :: [Definition] -> Doc ann

data Pat Source #

A pattern appearing on the LHS of a definition or match arm

Constructors

PatWildcard

Match anything, i.e., _

PatId Identifier

Variable or data constructor, e.g., v or Some

PatLit Literal

Literal match, e.g., 1

PatAs Identifier Pat

Pattern alias, e.g., a @ pat

PatTup [Pat]

Match on a tuple, e.g., (pat, pat)

PatApp [Pat]

Match on multiple patterns, e.g., Some a

PatAnn Typ Pat

Match with type annotation, e.g., pat: Type

Instances

Instances details
Eq Pat Source # 
Instance details

Defined in Front.Ast

Methods

(==) :: Pat -> Pat -> Bool #

(/=) :: Pat -> Pat -> Bool #

Data Pat Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pat -> c Pat #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pat #

toConstr :: Pat -> Constr #

dataTypeOf :: Pat -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Pat) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pat) #

gmapT :: (forall b. Data b => b -> b) -> Pat -> Pat #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pat -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pat -> r #

gmapQ :: (forall d. Data d => d -> u) -> Pat -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pat -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pat -> m Pat #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat -> m Pat #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pat -> m Pat #

Show Pat Source # 
Instance details

Defined in Front.Ast

Methods

showsPrec :: Int -> Pat -> ShowS #

show :: Pat -> String #

showList :: [Pat] -> ShowS #

Pretty Pat Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: Pat -> Doc ann

prettyList :: [Pat] -> Doc ann

data TypFn Source #

Function type annotation

Instances

Instances details
Eq TypFn Source # 
Instance details

Defined in Front.Ast

Methods

(==) :: TypFn -> TypFn -> Bool #

(/=) :: TypFn -> TypFn -> Bool #

Data TypFn Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TypFn -> c TypFn #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypFn #

toConstr :: TypFn -> Constr #

dataTypeOf :: TypFn -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TypFn) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypFn) #

gmapT :: (forall b. Data b => b -> b) -> TypFn -> TypFn #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypFn -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypFn -> r #

gmapQ :: (forall d. Data d => d -> u) -> TypFn -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TypFn -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypFn -> m TypFn #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypFn -> m TypFn #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypFn -> m TypFn #

Show TypFn Source # 
Instance details

Defined in Front.Ast

Methods

showsPrec :: Int -> TypFn -> ShowS #

show :: TypFn -> String #

showList :: [TypFn] -> ShowS #

Pretty TypFn Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: TypFn -> Doc ann

prettyList :: [TypFn] -> Doc ann

type TypAnn = Typ Source #

TODO: type classes

data Typ Source #

A type definition

Instances

Instances details
Eq Typ Source # 
Instance details

Defined in Front.Ast

Methods

(==) :: Typ -> Typ -> Bool #

(/=) :: Typ -> Typ -> Bool #

Data Typ Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Typ -> c Typ #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Typ #

toConstr :: Typ -> Constr #

dataTypeOf :: Typ -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Typ) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Typ) #

gmapT :: (forall b. Data b => b -> b) -> Typ -> Typ #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Typ -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Typ -> r #

gmapQ :: (forall d. Data d => d -> u) -> Typ -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Typ -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Typ -> m Typ #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Typ -> m Typ #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Typ -> m Typ #

Show Typ Source # 
Instance details

Defined in Front.Ast

Methods

showsPrec :: Int -> Typ -> ShowS #

show :: Typ -> String #

showList :: [Typ] -> ShowS #

Pretty Typ Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: Typ -> Doc ann

prettyList :: [Typ] -> Doc ann

data Expr Source #

An expression

Instances

Instances details
Eq Expr Source # 
Instance details

Defined in Front.Ast

Methods

(==) :: Expr -> Expr -> Bool #

(/=) :: Expr -> Expr -> Bool #

Data Expr Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Expr -> c Expr #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Expr #

toConstr :: Expr -> Constr #

dataTypeOf :: Expr -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Expr) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Expr) #

gmapT :: (forall b. Data b => b -> b) -> Expr -> Expr #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Expr -> r #

gmapQ :: (forall d. Data d => d -> u) -> Expr -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Expr -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Expr -> m Expr #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Expr -> m Expr #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Expr -> m Expr #

Show Expr Source # 
Instance details

Defined in Front.Ast

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #

Pretty Expr Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: Expr -> Doc ann

prettyList :: [Expr] -> Doc ann

data OpRegion Source #

An operator region: a flat list of alternating expressions and operators that is initially parsed flat but will be restructured into a tree by the operator precedence parser.

Instances

Instances details
Eq OpRegion Source # 
Instance details

Defined in Front.Ast

Data OpRegion Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OpRegion -> c OpRegion #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OpRegion #

toConstr :: OpRegion -> Constr #

dataTypeOf :: OpRegion -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OpRegion) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OpRegion) #

gmapT :: (forall b. Data b => b -> b) -> OpRegion -> OpRegion #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OpRegion -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OpRegion -> r #

gmapQ :: (forall d. Data d => d -> u) -> OpRegion -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OpRegion -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OpRegion -> m OpRegion #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OpRegion -> m OpRegion #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OpRegion -> m OpRegion #

Show OpRegion Source # 
Instance details

Defined in Front.Ast

data Literal Source #

A literal

Instances

Instances details
Eq Literal Source # 
Instance details

Defined in Front.Ast

Methods

(==) :: Literal -> Literal -> Bool #

(/=) :: Literal -> Literal -> Bool #

Data Literal Source # 
Instance details

Defined in Front.Ast

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Literal -> c Literal #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Literal #

toConstr :: Literal -> Constr #

dataTypeOf :: Literal -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Literal) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Literal) #

gmapT :: (forall b. Data b => b -> b) -> Literal -> Literal #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Literal -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Literal -> r #

gmapQ :: (forall d. Data d => d -> u) -> Literal -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Literal -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Literal -> m Literal #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Literal -> m Literal #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Literal -> m Literal #

Show Literal Source # 
Instance details

Defined in Front.Ast

Pretty Literal Source # 
Instance details

Defined in Front.Ast

Methods

pretty :: Literal -> Doc ann

prettyList :: [Literal] -> Doc ann

data Fixity Source #

Fixity declaration for binary operators.

foldApp :: Expr -> [Expr] -> Expr Source #

Apply a function to zero or more arguments.

Suppose we have as source code type Color = RGB Int Int Int ... let x = RGB 203 200 100 and rgb = Id RGB r = Lit (A.LitInt 203) g = Lit (A.LitInt 200) b = Lit (A.LitInt 100), then foldApp rgb [r, g, b] returns Apply (Apply (Apply (Id RGB) (Lit (LitInt 100))) (Lit (LitInt 200))) (Lit (LitInt 203))

collectTApp :: Typ -> (Typ, [Typ]) Source #

Collect a type application into the type constructor and its arguments.

collectApp :: Expr -> (Expr, [Expr]) Source #

Collect a curried application into the function and its list of arguments.

collectPApp :: Pat -> (Pat, [Pat]) Source #

Collect a pattern application into the destructor and arguments.

getTopDataDef :: TopDef -> Maybe Definition Source #

Unwrap a (potential) top-level data definition.

getTopTypeDef :: TopDef -> Maybe TypeDef Source #

Unwrap a (potential) top-level type definition.

getTopCDefs :: TopDef -> Maybe String Source #

Unwrap a (potential) top-level C inline block.

getTopExtern :: TopDef -> Maybe ExternDecl Source #

Unwrap a (potential) top-level external definition.

getTops :: [TopDef] -> ([TypeDef], [String], [ExternDecl], [Definition]) Source #

Unzip a list of top-level declarations into their counterparts.