sslang-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

IR.IR

Description

Sslang's intermediate representation and its associated helpers.

Synopsis

Documentation

data Program t Source #

Top-level compilation unit, parameterized by the type system.

Constructors

Program 

Instances

Instances details
Functor Program Source # 
Instance details

Defined in IR.IR

Methods

fmap :: (a -> b) -> Program a -> Program b #

(<$) :: a -> Program b -> Program a #

Foldable Program Source # 
Instance details

Defined in IR.IR

Methods

fold :: Monoid m => Program m -> m #

foldMap :: Monoid m => (a -> m) -> Program a -> m #

foldMap' :: Monoid m => (a -> m) -> Program a -> m #

foldr :: (a -> b -> b) -> b -> Program a -> b #

foldr' :: (a -> b -> b) -> b -> Program a -> b #

foldl :: (b -> a -> b) -> b -> Program a -> b #

foldl' :: (b -> a -> b) -> b -> Program a -> b #

foldr1 :: (a -> a -> a) -> Program a -> a #

foldl1 :: (a -> a -> a) -> Program a -> a #

toList :: Program a -> [a] #

null :: Program a -> Bool #

length :: Program a -> Int #

elem :: Eq a => a -> Program a -> Bool #

maximum :: Ord a => Program a -> a #

minimum :: Ord a => Program a -> a #

sum :: Num a => Program a -> a #

product :: Num a => Program a -> a #

Traversable Program Source # 
Instance details

Defined in IR.IR

Methods

traverse :: Applicative f => (a -> f b) -> Program a -> f (Program b) #

sequenceA :: Applicative f => Program (f a) -> f (Program a) #

mapM :: Monad m => (a -> m b) -> Program a -> m (Program b) #

sequence :: Monad m => Program (m a) -> m (Program a) #

Eq t => Eq (Program t) Source # 
Instance details

Defined in IR.IR

Methods

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

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

Data t => Data (Program t) Source # 
Instance details

Defined in IR.IR

Methods

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

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

toConstr :: Program t -> Constr #

dataTypeOf :: Program t -> DataType #

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

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

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

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

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

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

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

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

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

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

Show t => Show (Program t) Source # 
Instance details

Defined in IR.IR

Methods

showsPrec :: Int -> Program t -> ShowS #

show :: Program t -> String #

showList :: [Program t] -> ShowS #

Pretty (Program Type)

Pretty Typeclass: pretty print the IR

Adds * indentation and line breaks * some parens (not minimal parens, but fewer than around every node) Omits * let _ = * type annotations Reverts * curried funcs of one arg back to multiple arg funcs

Instance details

Defined in IR.Pretty

Methods

pretty :: Program Type -> Doc ann

prettyList :: [Program Type] -> Doc ann

data SymInfo t Source #

Information stored in global symbol table.

Constructors

SymInfo 

Fields

Instances

Instances details
Functor SymInfo Source # 
Instance details

Defined in IR.IR

Methods

fmap :: (a -> b) -> SymInfo a -> SymInfo b #

(<$) :: a -> SymInfo b -> SymInfo a #

Foldable SymInfo Source # 
Instance details

Defined in IR.IR

Methods

fold :: Monoid m => SymInfo m -> m #

foldMap :: Monoid m => (a -> m) -> SymInfo a -> m #

foldMap' :: Monoid m => (a -> m) -> SymInfo a -> m #

foldr :: (a -> b -> b) -> b -> SymInfo a -> b #

foldr' :: (a -> b -> b) -> b -> SymInfo a -> b #

foldl :: (b -> a -> b) -> b -> SymInfo a -> b #

foldl' :: (b -> a -> b) -> b -> SymInfo a -> b #

foldr1 :: (a -> a -> a) -> SymInfo a -> a #

foldl1 :: (a -> a -> a) -> SymInfo a -> a #

toList :: SymInfo a -> [a] #

null :: SymInfo a -> Bool #

length :: SymInfo a -> Int #

elem :: Eq a => a -> SymInfo a -> Bool #

maximum :: Ord a => SymInfo a -> a #

minimum :: Ord a => SymInfo a -> a #

sum :: Num a => SymInfo a -> a #

product :: Num a => SymInfo a -> a #

Traversable SymInfo Source # 
Instance details

Defined in IR.IR

Methods

traverse :: Applicative f => (a -> f b) -> SymInfo a -> f (SymInfo b) #

sequenceA :: Applicative f => SymInfo (f a) -> f (SymInfo a) #

mapM :: Monad m => (a -> m b) -> SymInfo a -> m (SymInfo b) #

sequence :: Monad m => SymInfo (m a) -> m (SymInfo a) #

Eq t => Eq (SymInfo t) Source # 
Instance details

Defined in IR.IR

Methods

(==) :: SymInfo t -> SymInfo t -> Bool #

(/=) :: SymInfo t -> SymInfo t -> Bool #

Data t => Data (SymInfo t) Source # 
Instance details

Defined in IR.IR

Methods

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

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

toConstr :: SymInfo t -> Constr #

dataTypeOf :: SymInfo t -> DataType #

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

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

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

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

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

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

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

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

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

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

Show t => Show (SymInfo t) Source # 
Instance details

Defined in IR.IR

Methods

showsPrec :: Int -> SymInfo t -> ShowS #

show :: SymInfo t -> String #

showList :: [SymInfo t] -> ShowS #

data TypeDef Source #

The type definition associated with a type constructor. A definition for `data MyList a = Cons a (MyList a) | Nil` looks like: TypeDef { targs = [a] , [ (Cons, VariantUnnamed [TVar a, TCon (MyList [TVar a])]) , (Nil, VariantUnnamed []) ] } (Data constructors for identifiers are omitted for brevity.) Note that for a flat type system, where all type constructors are nullary, targs will just be set to [].

Constructors

TypeDef 

Fields

Instances

Instances details
Eq TypeDef Source # 
Instance details

Defined in IR.IR

Methods

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

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

Data TypeDef Source # 
Instance details

Defined in IR.IR

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 IR.IR

data TypeVariant Source #

Arguments to a data constructor, whose fields may or may not be named

Constructors

VariantNamed [(VarId, Type)]

A record with named fields

VariantUnnamed [Type]

An algebraic type with unnamed fields

Instances

Instances details
Eq TypeVariant Source # 
Instance details

Defined in IR.IR

Data TypeVariant Source # 
Instance details

Defined in IR.IR

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 IR.IR

data Binder t Source #

A name to be bound; Nothing represents a wildcard, e.g., let _ = ....

Constructors

Binder 

Fields

Instances

Instances details
Functor Binder Source # 
Instance details

Defined in IR.IR

Methods

fmap :: (a -> b) -> Binder a -> Binder b #

(<$) :: a -> Binder b -> Binder a #

Foldable Binder Source # 
Instance details

Defined in IR.IR

Methods

fold :: Monoid m => Binder m -> m #

foldMap :: Monoid m => (a -> m) -> Binder a -> m #

foldMap' :: Monoid m => (a -> m) -> Binder a -> m #

foldr :: (a -> b -> b) -> b -> Binder a -> b #

foldr' :: (a -> b -> b) -> b -> Binder a -> b #

foldl :: (b -> a -> b) -> b -> Binder a -> b #

foldl' :: (b -> a -> b) -> b -> Binder a -> b #

foldr1 :: (a -> a -> a) -> Binder a -> a #

foldl1 :: (a -> a -> a) -> Binder a -> a #

toList :: Binder a -> [a] #

null :: Binder a -> Bool #

length :: Binder a -> Int #

elem :: Eq a => a -> Binder a -> Bool #

maximum :: Ord a => Binder a -> a #

minimum :: Ord a => Binder a -> a #

sum :: Num a => Binder a -> a #

product :: Num a => Binder a -> a #

Traversable Binder Source # 
Instance details

Defined in IR.IR

Methods

traverse :: Applicative f => (a -> f b) -> Binder a -> f (Binder b) #

sequenceA :: Applicative f => Binder (f a) -> f (Binder a) #

mapM :: Monad m => (a -> m b) -> Binder a -> m (Binder b) #

sequence :: Monad m => Binder (m a) -> m (Binder a) #

Carrier Binder Source # 
Instance details

Defined in IR.IR

Methods

extract :: Binder a -> a Source #

inject :: a -> Binder a -> Binder a Source #

Eq t => Eq (Binder t) Source # 
Instance details

Defined in IR.IR

Methods

(==) :: Binder t -> Binder t -> Bool #

(/=) :: Binder t -> Binder t -> Bool #

Data t => Data (Binder t) Source # 
Instance details

Defined in IR.IR

Methods

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

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

toConstr :: Binder t -> Constr #

dataTypeOf :: Binder t -> DataType #

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

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

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

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

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

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

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

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

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

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

Show t => Show (Binder t) Source # 
Instance details

Defined in IR.IR

Methods

showsPrec :: Int -> Binder t -> ShowS #

show :: Binder t -> String #

showList :: [Binder t] -> ShowS #

data Literal Source #

Literal values supported by the language.

Note that these don't carry any connotation of type: 1 just means 1,

Instances

Instances details
Eq Literal Source # 
Instance details

Defined in IR.IR

Methods

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

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

Data Literal Source # 
Instance details

Defined in IR.IR

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 IR.IR

Pretty Literal 
Instance details

Defined in IR.Pretty

Methods

pretty :: Literal -> Doc ann

prettyList :: [Literal] -> Doc ann

data PrimOp Source #

Primitive operations.

These should be the kinds of functions one may expect to be available as operators in C, or as instructions in an assembly language.

For simplicity and consistency, they should be:

  • Pure (i.e., side-effectful iff operands are side-effectful, i.e., no =)
  • Strict in all operands (i.e., no && or ||)

We can instead implement short-circuit control flow using match statements.

Constructors

PrimNeg

negation, i.e., -x

PrimNot

logical not, i.e., !x

PrimBitNot

bitwise not, i.e., ~x

PrimAdd

addition, i.e., x + y

PrimSub

subtraction, i.e., x - y

PrimMul

multiplication, i.e., x * y

PrimDiv

division, i.e., x / y

PrimMod

modulus, i.e., x % y

PrimBitAnd

bitwise-and, i.e., x & y

PrimBitOr

bitwise-or, i.e., x | y

PrimEq

equality, i.e., x == y

PrimNeq

equality, i.e., x != y

PrimGt

greater than, i.e., x > y

PrimGe

greater than or equal to, i.e., x >= y

PrimLt

less than, i.e., x < y

PrimLe

less than or equal to, i.e., x <= y

Instances

Instances details
Eq PrimOp Source # 
Instance details

Defined in IR.IR

Methods

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

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

Data PrimOp Source # 
Instance details

Defined in IR.IR

Methods

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

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

toConstr :: PrimOp -> Constr #

dataTypeOf :: PrimOp -> DataType #

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

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

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

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

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

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

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

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

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

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

Show PrimOp Source # 
Instance details

Defined in IR.IR

Pretty PrimOp 
Instance details

Defined in IR.Pretty

Methods

pretty :: PrimOp -> Doc ann

prettyList :: [PrimOp] -> Doc ann

data Primitive Source #

Primitive functions for side-effects and imperative control flow.

Constructors

New

New e allocates a schedule variable initialized to e, and returns a reference to it.

Dup

Dup r dups the reference r and returns r.

Drop

Drop e r evaluates to e, but also drops r.

Deref

Deref r dereferences reference r to obtain its value.

Assign

Assign r e instantly assigns value e to reference r.

After

After t r e assigns e to reference r after time t.

Par

Par es+ evaluates expressions es concurrently.

Wait

Wait rs+ waits for an assignment to any reference in rs.

Loop

Loop b loops body b forever.

Break

Break breaks out of the innermost loop.

Now

Now obtains the value of the current instant

Last

Last obtains the time a value was last assigned

PrimOp PrimOp

Inlined C expression code.

CQuote String

Primitive operator.

CCall CSym

Direct call to arbitrary C function (NOTE: HACKY).

FfiCall VarId

Call to well-typed extern symbol.

Instances

Instances details
Eq Primitive Source # 
Instance details

Defined in IR.IR

Data Primitive Source # 
Instance details

Defined in IR.IR

Methods

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

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

toConstr :: Primitive -> Constr #

dataTypeOf :: Primitive -> DataType #

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

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

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

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

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

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

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

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

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

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

Show Primitive Source # 
Instance details

Defined in IR.IR

data Expr t Source #

Expressions, based on the let-polymorphic lambda calculus.

t represents the type of this expression, e.g., Flat. At various stages, this may represent a richer or simpler type system. The type is embedded in each data constructor so as to type-annotate the entire expression tree.

Designed for side effects with call-by-value evaluation order. Basic sequencing can be recovered through let-bindings:

let _ = stmt1 in
let _ = stmt2 in
...

Effects of stmt1 take place before that of stmt2.

Constructors

Var VarId t

Var n t is a variable named n of type t.

Data DConId t

Data d t is a data constructor named d of type t.

Lit Literal t

Lit l t is a literal value l of type t.

App (Expr t) (Expr t) t

App f a t applies function f to argument a, producing a value of type t.

Let [(Binder t, Expr t)] (Expr t) t

Let [(n, v)] b t binds value v to variable v in its body b.

The bindings list may only be of length greater than 1 for a set of mutually co-recursive functions.

Lambda (Binder t) (Expr t) t

Lambda v b t constructs an anonymous function of type t that binds a value to parameter v in its body b.

Match (Expr t) [(Alt t, Expr t)] t

Match s alts t pattern-matches on scrutinee s against alternatives alts, each producing a value of type t.

Prim Primitive [Expr t] t

Prim p es t applies primitive p arguments es, producing a value of type t.

Exception ExceptType t

Exception et t produces a exception for the program.

Instances

Instances details
Functor Expr Source # 
Instance details

Defined in IR.IR

Methods

fmap :: (a -> b) -> Expr a -> Expr b #

(<$) :: a -> Expr b -> Expr a #

Foldable Expr Source # 
Instance details

Defined in IR.IR

Methods

fold :: Monoid m => Expr m -> m #

foldMap :: Monoid m => (a -> m) -> Expr a -> m #

foldMap' :: Monoid m => (a -> m) -> Expr a -> m #

foldr :: (a -> b -> b) -> b -> Expr a -> b #

foldr' :: (a -> b -> b) -> b -> Expr a -> b #

foldl :: (b -> a -> b) -> b -> Expr a -> b #

foldl' :: (b -> a -> b) -> b -> Expr a -> b #

foldr1 :: (a -> a -> a) -> Expr a -> a #

foldl1 :: (a -> a -> a) -> Expr a -> a #

toList :: Expr a -> [a] #

null :: Expr a -> Bool #

length :: Expr a -> Int #

elem :: Eq a => a -> Expr a -> Bool #

maximum :: Ord a => Expr a -> a #

minimum :: Ord a => Expr a -> a #

sum :: Num a => Expr a -> a #

product :: Num a => Expr a -> a #

Traversable Expr Source # 
Instance details

Defined in IR.IR

Methods

traverse :: Applicative f => (a -> f b) -> Expr a -> f (Expr b) #

sequenceA :: Applicative f => Expr (f a) -> f (Expr a) #

mapM :: Monad m => (a -> m b) -> Expr a -> m (Expr b) #

sequence :: Monad m => Expr (m a) -> m (Expr a) #

Carrier Expr Source #

Extract the type carried by an Expr.

Instance details

Defined in IR.IR

Methods

extract :: Expr a -> a Source #

inject :: a -> Expr a -> Expr a Source #

Eq t => Eq (Expr t) Source # 
Instance details

Defined in IR.IR

Methods

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

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

Data t => Data (Expr t) Source # 
Instance details

Defined in IR.IR

Methods

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

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

toConstr :: Expr t -> Constr #

dataTypeOf :: Expr t -> DataType #

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

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

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

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

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

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

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

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

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

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

Show t => Show (Expr t) Source # 
Instance details

Defined in IR.IR

Methods

showsPrec :: Int -> Expr t -> ShowS #

show :: Expr t -> String #

showList :: [Expr t] -> ShowS #

Pretty (Expr Type) 
Instance details

Defined in IR.Pretty

Methods

pretty :: Expr Type -> Doc ann

prettyList :: [Expr Type] -> Doc ann

HasFreeVars (Expr t) VarId Source # 
Instance details

Defined in IR.IR

Methods

freeVars :: Expr t -> Set VarId Source #

data Alt t Source #

An alternative in a pattern-match.

Constructors

AltData DConId [Alt t] t

AltData d vs matches data constructor d, and recursive patterns alts.

AltLit Literal t

AltLit l matches against literal l, producing expression e.

AltBinder (Binder t)

AltBinder v matches anything, and bound to name v.

Instances

Instances details
Functor Alt Source # 
Instance details

Defined in IR.IR

Methods

fmap :: (a -> b) -> Alt a -> Alt b #

(<$) :: a -> Alt b -> Alt a #

Foldable Alt Source # 
Instance details

Defined in IR.IR

Methods

fold :: Monoid m => Alt m -> m #

foldMap :: Monoid m => (a -> m) -> Alt a -> m #

foldMap' :: Monoid m => (a -> m) -> Alt a -> m #

foldr :: (a -> b -> b) -> b -> Alt a -> b #

foldr' :: (a -> b -> b) -> b -> Alt a -> b #

foldl :: (b -> a -> b) -> b -> Alt a -> b #

foldl' :: (b -> a -> b) -> b -> Alt a -> b #

foldr1 :: (a -> a -> a) -> Alt a -> a #

foldl1 :: (a -> a -> a) -> Alt a -> a #

toList :: Alt a -> [a] #

null :: Alt a -> Bool #

length :: Alt a -> Int #

elem :: Eq a => a -> Alt a -> Bool #

maximum :: Ord a => Alt a -> a #

minimum :: Ord a => Alt a -> a #

sum :: Num a => Alt a -> a #

product :: Num a => Alt a -> a #

Traversable Alt Source # 
Instance details

Defined in IR.IR

Methods

traverse :: Applicative f => (a -> f b) -> Alt a -> f (Alt b) #

sequenceA :: Applicative f => Alt (f a) -> f (Alt a) #

mapM :: Monad m => (a -> m b) -> Alt a -> m (Alt b) #

sequence :: Monad m => Alt (m a) -> m (Alt a) #

Carrier Alt Source # 
Instance details

Defined in IR.IR

Methods

extract :: Alt a -> a Source #

inject :: a -> Alt a -> Alt a Source #

Eq t => Eq (Alt t) Source # 
Instance details

Defined in IR.IR

Methods

(==) :: Alt t -> Alt t -> Bool #

(/=) :: Alt t -> Alt t -> Bool #

Data t => Data (Alt t) Source # 
Instance details

Defined in IR.IR

Methods

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

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

toConstr :: Alt t -> Constr #

dataTypeOf :: Alt t -> DataType #

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

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

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

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

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

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

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

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

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

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

Show t => Show (Alt t) Source # 
Instance details

Defined in IR.IR

Methods

showsPrec :: Int -> Alt t -> ShowS #

show :: Alt t -> String #

showList :: [Alt t] -> ShowS #

Pretty (Alt Type) 
Instance details

Defined in IR.Pretty

Methods

pretty :: Alt Type -> Doc ann

prettyList :: [Alt Type] -> Doc ann

newtype VarId Source #

Identifier for data variables, e.g., x.

Constructors

VarId Identifier 

Instances

Instances details
Eq VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

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

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

Data VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

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

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

toConstr :: VarId -> Constr #

dataTypeOf :: VarId -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

compare :: VarId -> VarId -> Ordering #

(<) :: VarId -> VarId -> Bool #

(<=) :: VarId -> VarId -> Bool #

(>) :: VarId -> VarId -> Bool #

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

max :: VarId -> VarId -> VarId #

min :: VarId -> VarId -> VarId #

Show VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

showsPrec :: Int -> VarId -> ShowS #

show :: VarId -> String #

showList :: [VarId] -> ShowS #

IsString VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

fromString :: String -> VarId #

Semigroup VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

(<>) :: VarId -> VarId -> VarId #

sconcat :: NonEmpty VarId -> VarId #

stimes :: Integral b => b -> VarId -> VarId #

Monoid VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

mempty :: VarId #

mappend :: VarId -> VarId -> VarId #

mconcat :: [VarId] -> VarId #

Pretty VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

pretty :: VarId -> Doc ann

prettyList :: [VarId] -> Doc ann

ToIdent VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

toIdent :: VarId -> SrcLoc -> Id

Identifiable VarId Source # 
Instance details

Defined in Common.Identifiers

Methods

ident :: VarId -> String Source #

HasFreeVars (Expr t) VarId Source # 
Instance details

Defined in IR.IR

Methods

freeVars :: Expr t -> Set VarId Source #

newtype TConId Source #

Identifier for type constructors, e.g., Option.

Constructors

TConId Identifier 

Instances

Instances details
Eq TConId Source # 
Instance details

Defined in Common.Identifiers

Methods

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

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

Data TConId Source # 
Instance details

Defined in Common.Identifiers

Methods

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

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

toConstr :: TConId -> Constr #

dataTypeOf :: TConId -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord TConId Source # 
Instance details

Defined in Common.Identifiers

Show TConId Source # 
Instance details

Defined in Common.Identifiers

IsString TConId Source # 
Instance details

Defined in Common.Identifiers

Methods

fromString :: String -> TConId #

Semigroup TConId Source # 
Instance details

Defined in Common.Identifiers

Monoid TConId Source # 
Instance details

Defined in Common.Identifiers

Pretty TConId Source # 
Instance details

Defined in Common.Identifiers

Methods

pretty :: TConId -> Doc ann

prettyList :: [TConId] -> Doc ann

ToIdent TConId Source # 
Instance details

Defined in Common.Identifiers

Methods

toIdent :: TConId -> SrcLoc -> Id

Identifiable TConId Source # 
Instance details

Defined in Common.Identifiers

Methods

ident :: TConId -> String Source #

newtype DConId Source #

Identifier for data constructors, e.g., None.

Constructors

DConId Identifier 

Instances

Instances details
Eq DConId Source # 
Instance details

Defined in Common.Identifiers

Methods

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

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

Data DConId Source # 
Instance details

Defined in Common.Identifiers

Methods

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

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

toConstr :: DConId -> Constr #

dataTypeOf :: DConId -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord DConId Source # 
Instance details

Defined in Common.Identifiers

Show DConId Source # 
Instance details

Defined in Common.Identifiers

IsString DConId Source # 
Instance details

Defined in Common.Identifiers

Methods

fromString :: String -> DConId #

Semigroup DConId Source # 
Instance details

Defined in Common.Identifiers

Monoid DConId Source # 
Instance details

Defined in Common.Identifiers

Pretty DConId Source # 
Instance details

Defined in Common.Identifiers

Methods

pretty :: DConId -> Doc ann

prettyList :: [DConId] -> Doc ann

ToIdent DConId Source # 
Instance details

Defined in Common.Identifiers

Methods

toIdent :: DConId -> SrcLoc -> Id

Identifiable DConId Source # 
Instance details

Defined in Common.Identifiers

Methods

ident :: DConId -> String Source #

newtype ExceptType Source #

Constructors

ExceptDefault Literal 

Instances

Instances details
Eq ExceptType Source # 
Instance details

Defined in IR.IR

Data ExceptType Source # 
Instance details

Defined in IR.IR

Methods

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

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

toConstr :: ExceptType -> Constr #

dataTypeOf :: ExceptType -> DataType #

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

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

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

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

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

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

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

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

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

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

Show ExceptType Source # 
Instance details

Defined in IR.IR

Pretty ExceptType 
Instance details

Defined in IR.Pretty

Methods

pretty :: ExceptType -> Doc ann

prettyList :: [ExceptType] -> Doc ann

data Type Source #

Encoding of sslang types.

Structurally speaking, these are very simple. Types are either type variables or type constructors applied to some other types.

Builtin types (and type constructors) include Arrow, Unit, Ref, List, and various sizes of tuples; for convenience, those are defined elsewhere using the GHC PatternSynonyms extension.

Instances

Instances details
Eq Type Source # 
Instance details

Defined in IR.Types.Type

Methods

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

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

Data Type Source # 
Instance details

Defined in IR.Types.Type

Methods

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

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

toConstr :: Type -> Constr #

dataTypeOf :: Type -> DataType #

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

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

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

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

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

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

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

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

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

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

Show Type Source # 
Instance details

Defined in IR.Types.Type

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Pretty Type Source # 
Instance details

Defined in IR.Types.Type

Methods

pretty :: Type -> Doc ann

prettyList :: [Type] -> Doc ann

Dumpy Type Source # 
Instance details

Defined in IR.Types.Type

Methods

dumpy :: Type -> Doc ann Source #

HasType Type Source # 
Instance details

Defined in IR.Types.Type

Methods

getType :: Type -> Type Source #

HasFreeVars Type TVarId Source # 
Instance details

Defined in IR.Types.Type

Pretty (Alt Type) 
Instance details

Defined in IR.Pretty

Methods

pretty :: Alt Type -> Doc ann

prettyList :: [Alt Type] -> Doc ann

Pretty (Expr Type) 
Instance details

Defined in IR.Pretty

Methods

pretty :: Expr Type -> Doc ann

prettyList :: [Expr Type] -> Doc ann

Pretty (Program Type)

Pretty Typeclass: pretty print the IR

Adds * indentation and line breaks * some parens (not minimal parens, but fewer than around every node) Omits * let _ = * type annotations Reverts * curried funcs of one arg back to multiple arg funcs

Instance details

Defined in IR.Pretty

Methods

pretty :: Program Type -> Doc ann

prettyList :: [Program Type] -> Doc ann

data Annotation Source #

An annotation records the annotated portion of a pattern.

Instances

Instances details
Eq Annotation Source # 
Instance details

Defined in IR.Types.Type

Data Annotation Source # 
Instance details

Defined in IR.Types.Type

Methods

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

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

toConstr :: Annotation -> Constr #

dataTypeOf :: Annotation -> DataType #

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

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

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

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

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

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

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

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

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

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

Show Annotation Source # 
Instance details

Defined in IR.Types.Type

Pretty Annotation Source # 
Instance details

Defined in IR.Types.Type

Methods

pretty :: Annotation -> Doc ann

prettyList :: [Annotation] -> Doc ann

Dumpy Annotation Source # 
Instance details

Defined in IR.Types.Type

Methods

dumpy :: Annotation -> Doc ann Source #

data Annotations Source #

Expressions are annotated with a (potentially empty) list of Annotation.

Instances

Instances details
Eq Annotations Source # 
Instance details

Defined in IR.Types.Type

Data Annotations Source # 
Instance details

Defined in IR.Types.Type

Methods

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

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

toConstr :: Annotations -> Constr #

dataTypeOf :: Annotations -> DataType #

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

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

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

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

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

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

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

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

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

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

Show Annotations Source # 
Instance details

Defined in IR.Types.Type

Semigroup Annotations Source # 
Instance details

Defined in IR.Types.Type

Monoid Annotations Source # 
Instance details

Defined in IR.Types.Type

Pretty Annotations Source # 
Instance details

Defined in IR.Types.Type

Methods

pretty :: Annotations -> Doc ann

prettyList :: [Annotations] -> Doc ann

Dumpy Annotations Source # 
Instance details

Defined in IR.Types.Type

Methods

dumpy :: Annotations -> Doc ann Source #

variantFields :: TypeVariant -> Int Source #

The number of fields in a TypeVariant.

foldLambda :: [Binder Type] -> Expr Type -> Expr Type Source #

Create a lambda chain given a list of argument-type pairs and a body.

unfoldLambda :: Expr t -> ([Binder t], Expr t) Source #

Collect a curried list of function arguments from a nesting of lambdas.

extract :: Carrier c => c a -> a Source #

Extract the data carried by the carrier.

inject :: Carrier c => a -> c a -> c a Source #

Replace the data carried by the carrier.

injectMore :: (Semigroup a, Carrier c) => a -> c a -> c a Source #

foldApp :: Expr t -> [(Expr t, t)] -> Expr t Source #

Apply a function to zero or more arguments.

foldApp is the inverse of unfoldApp.

unfoldApp :: Expr t -> (Expr t, [(Expr t, t)]) Source #

Collect a curried application into the function and argument list.

The type accompanying each argument represents type produced by the application, and is extracted from the App node that this function unwraps.

For example, the term f a b (where a: A and b: B) would be represented by the following AST: @ (App (App (Var f (A -> B -> C)) (Var a A) (B -> C)) (Var b B) C) @

which, when unzipped, gives:

@ (Var f (A -> B -> C)) [(Var a A, B -> C), (Var b B, C)] @

unfoldApp is the inverse of foldApp.

isValue :: Expr t -> Bool Source #

Whether an expression is a value.

altBinders :: Alt t -> [Binder t] Source #

Retrieve list of binders from an Alt.

pattern BindVar :: VarId -> t -> Binder t Source #

A concrete, named binder.

pattern BindAnon :: t -> Binder t Source #

An anonymous (wildcard) binder.

class Carrier c Source #

Many data types carry other kinds of data, e.g., Expr carries a type.

Minimal complete definition

extract, inject

Instances

Instances details
Carrier Alt Source # 
Instance details

Defined in IR.IR

Methods

extract :: Alt a -> a Source #

inject :: a -> Alt a -> Alt a Source #

Carrier Expr Source #

Extract the type carried by an Expr.

Instance details

Defined in IR.IR

Methods

extract :: Expr a -> a Source #

inject :: a -> Expr a -> Expr a Source #

Carrier Binder Source # 
Instance details

Defined in IR.IR

Methods

extract :: Binder a -> a Source #

inject :: a -> Binder a -> Binder a Source #

type SymTable t = Map VarId (SymInfo t) Source #

Contains information about all (globally unique) variable names.

Populated by name mangling pass.