gibbon-0.3: A compiler for operating on serialized data
Safe HaskellSafe-Inferred
LanguageHaskell2010

Gibbon.L0.Syntax

Description

A higher-ordered surface language that supports Rank-1 parametric polymorphism.

Synopsis

Documentation

data E0Ext loc dec Source #

The extension point for L0.

Constructors

LambdaE [(Var, dec)] (PreExp E0Ext loc dec) 
PolyAppE (PreExp E0Ext loc dec) (PreExp E0Ext loc dec) 
FunRefE [loc] Var 
BenchE Var [loc] [PreExp E0Ext loc dec] Bool 
ParE0 [PreExp E0Ext loc dec] 
PrintPacked dec (PreExp E0Ext loc dec)

Print a packed value to standard out.

CopyPacked dec (PreExp E0Ext loc dec)

Copy a packed value.

TravPacked dec (PreExp E0Ext loc dec)

Traverse a packed value.

L Loc (PreExp E0Ext loc dec) 
LinearExt (LinearExt loc dec) 

Instances

Instances details
Interp () Exp0 Source # 
Instance details

Defined in Gibbon.L0.Interp

InterpProg () Exp0 Source # 
Instance details

Defined in Gibbon.L0.Interp

InterpExt () Exp0 (E0Ext Ty0 Ty0) Source # 
Instance details

Defined in Gibbon.L0.Interp

(Out l, Out d) => Out (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

docPrec :: Int -> E0Ext l d -> Doc Source #

doc :: E0Ext l d -> Doc Source #

docList :: [E0Ext l d] -> Doc Source #

Generic (E0Ext loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type Rep (E0Ext loc dec) :: Type -> Type Source #

Methods

from :: E0Ext loc dec -> Rep (E0Ext loc dec) x Source #

to :: Rep (E0Ext loc dec) x -> E0Ext loc dec Source #

(Read loc, Read dec) => Read (E0Ext loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

readsPrec :: Int -> ReadS (E0Ext loc dec) Source #

readList :: ReadS [E0Ext loc dec] Source #

readPrec :: ReadPrec (E0Ext loc dec) Source #

readListPrec :: ReadPrec [E0Ext loc dec] Source #

(Show loc, Show dec) => Show (E0Ext loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

showsPrec :: Int -> E0Ext loc dec -> ShowS Source #

show :: E0Ext loc dec -> String Source #

showList :: [E0Ext loc dec] -> ShowS Source #

(NFData dec, NFData loc) => NFData (E0Ext loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

rnf :: E0Ext loc dec -> () Source #

(Eq loc, Eq dec) => Eq (E0Ext loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

(==) :: E0Ext loc dec -> E0Ext loc dec -> Bool Source #

(/=) :: E0Ext loc dec -> E0Ext loc dec -> Bool Source #

(Ord loc, Ord dec) => Ord (E0Ext loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

compare :: E0Ext loc dec -> E0Ext loc dec -> Ordering Source #

(<) :: E0Ext loc dec -> E0Ext loc dec -> Bool Source #

(<=) :: E0Ext loc dec -> E0Ext loc dec -> Bool Source #

(>) :: E0Ext loc dec -> E0Ext loc dec -> Bool Source #

(>=) :: E0Ext loc dec -> E0Ext loc dec -> Bool Source #

max :: E0Ext loc dec -> E0Ext loc dec -> E0Ext loc dec Source #

min :: E0Ext loc dec -> E0Ext loc dec -> E0Ext loc dec Source #

(Out l, Out d, Show l, Show d) => Expression (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type TyOf (E0Ext l d) Source #

type LocOf (E0Ext l d) Source #

Methods

isTrivial :: E0Ext l d -> Bool Source #

(Show l, Out l) => Flattenable (E0Ext l Ty0) Source # 
Instance details

Defined in Gibbon.L0.Syntax

FreeVars (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gFreeVars :: E0Ext l d -> Set Var Source #

HasRenamable E0Ext l d => Renamable (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gRename :: Map Var Var -> E0Ext l d -> E0Ext l d Source #

(Out a, Pretty a) => Pretty (E0Ext a Ty0) Source # 
Instance details

Defined in Gibbon.Pretty

HasSubstitutableExt E0Ext l d => SubstitutableExt (PreExp E0Ext l d) (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gSubstExt :: Var -> PreExp E0Ext l d -> E0Ext l d -> E0Ext l d Source #

gSubstEExt :: PreExp E0Ext l d -> PreExp E0Ext l d -> E0Ext l d -> E0Ext l d Source #

HasSubstitutableExt E0Ext l d => SubstitutableExt (PreExp E0Ext l d) (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gSubstExt :: Var -> PreExp E0Ext l d -> LinearExt l d -> LinearExt l d Source #

gSubstEExt :: PreExp E0Ext l d -> PreExp E0Ext l d -> LinearExt l d -> LinearExt l d Source #

type Rep (E0Ext loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

type Rep (E0Ext loc dec) = D1 ('MetaData "E0Ext" "Gibbon.L0.Syntax" "gibbon-0.3-inplace" 'False) (((C1 ('MetaCons "LambdaE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Var, dec)]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp E0Ext loc dec))) :+: C1 ('MetaCons "PolyAppE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp E0Ext loc dec)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp E0Ext loc dec)))) :+: (C1 ('MetaCons "FunRefE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [loc]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var)) :+: (C1 ('MetaCons "BenchE" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [loc])) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PreExp E0Ext loc dec]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :+: C1 ('MetaCons "ParE0" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PreExp E0Ext loc dec]))))) :+: ((C1 ('MetaCons "PrintPacked" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 dec) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp E0Ext loc dec))) :+: C1 ('MetaCons "CopyPacked" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 dec) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp E0Ext loc dec)))) :+: (C1 ('MetaCons "TravPacked" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 dec) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp E0Ext loc dec))) :+: (C1 ('MetaCons "L" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp E0Ext loc dec))) :+: C1 ('MetaCons "LinearExt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (LinearExt loc dec)))))))
type LocOf (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

type LocOf (E0Ext l d) = l
type TyOf (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

type TyOf (E0Ext l d) = d

data Ty0 Source #

Instances

Instances details
Out Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

docPrec :: Int -> Ty0 -> Doc Source #

doc :: Ty0 -> Doc Source #

docList :: [Ty0] -> Doc Source #

Generic Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type Rep Ty0 :: Type -> Type Source #

Methods

from :: Ty0 -> Rep Ty0 x Source #

to :: Rep Ty0 x -> Ty0 Source #

Read Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Show Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

NFData Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

rnf :: Ty0 -> () Source #

Eq Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

(==) :: Ty0 -> Ty0 -> Bool Source #

(/=) :: Ty0 -> Ty0 -> Bool Source #

Ord Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

compare :: Ty0 -> Ty0 -> Ordering Source #

(<) :: Ty0 -> Ty0 -> Bool Source #

(<=) :: Ty0 -> Ty0 -> Bool Source #

(>) :: Ty0 -> Ty0 -> Bool Source #

(>=) :: Ty0 -> Ty0 -> Bool Source #

max :: Ty0 -> Ty0 -> Ty0 Source #

min :: Ty0 -> Ty0 -> Ty0 Source #

FunctionTy Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type ArrowTy Ty0 Source #

Renamable Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gRename :: Map Var Var -> Ty0 -> Ty0 Source #

Pretty Ty0 Source # 
Instance details

Defined in Gibbon.Pretty

Interp () Exp0 Source # 
Instance details

Defined in Gibbon.L0.Interp

InterpProg () Exp0 Source # 
Instance details

Defined in Gibbon.L0.Interp

InterpExt () Exp0 (E0Ext Ty0 Ty0) Source # 
Instance details

Defined in Gibbon.L0.Interp

(Show l, Out l) => Flattenable (E0Ext l Ty0) Source # 
Instance details

Defined in Gibbon.L0.Syntax

(Show l, Out l) => Flattenable (LinearExt l Ty0) Source # 
Instance details

Defined in Gibbon.L0.Syntax

(Out a, Pretty a) => Pretty (E0Ext a Ty0) Source # 
Instance details

Defined in Gibbon.Pretty

type Rep Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

type Rep Ty0 = D1 ('MetaData "Ty0" "Gibbon.L0.Syntax" "gibbon-0.3-inplace" 'False) ((((C1 ('MetaCons "IntTy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CharTy" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FloatTy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SymTy0" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "BoolTy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TyVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyVar))) :+: (C1 ('MetaCons "MetaTv" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MetaTv)) :+: (C1 ('MetaCons "ProdTy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ty0])) :+: C1 ('MetaCons "SymDictTy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Var)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ty0)))))) :+: (((C1 ('MetaCons "PDictTy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ty0) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ty0)) :+: C1 ('MetaCons "SymSetTy" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "SymHashTy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntHashTy" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "ArrowTy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ty0]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ty0)) :+: C1 ('MetaCons "PackedTy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyCon) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Ty0]))) :+: (C1 ('MetaCons "VectorTy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ty0)) :+: (C1 ('MetaCons "ListTy" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ty0)) :+: C1 ('MetaCons "ArenaTy" 'PrefixI 'False) (U1 :: Type -> Type))))))
type ArrowTy Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

data LinearExt loc dec Source #

Linear types primitives.

Constructors

ReverseAppE (PreExp E0Ext loc dec) (PreExp E0Ext loc dec) 
LseqE (PreExp E0Ext loc dec) (PreExp E0Ext loc dec) 
AliasE (PreExp E0Ext loc dec) 
ToLinearE (PreExp E0Ext loc dec) 

Instances

Instances details
(Out l, Out d) => Out (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

docPrec :: Int -> LinearExt l d -> Doc Source #

doc :: LinearExt l d -> Doc Source #

docList :: [LinearExt l d] -> Doc Source #

Generic (LinearExt loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type Rep (LinearExt loc dec) :: Type -> Type Source #

Methods

from :: LinearExt loc dec -> Rep (LinearExt loc dec) x Source #

to :: Rep (LinearExt loc dec) x -> LinearExt loc dec Source #

(Read loc, Read dec) => Read (LinearExt loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

(Show loc, Show dec) => Show (LinearExt loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

showsPrec :: Int -> LinearExt loc dec -> ShowS Source #

show :: LinearExt loc dec -> String Source #

showList :: [LinearExt loc dec] -> ShowS Source #

(NFData loc, NFData dec) => NFData (LinearExt loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

rnf :: LinearExt loc dec -> () Source #

(Eq loc, Eq dec) => Eq (LinearExt loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

(==) :: LinearExt loc dec -> LinearExt loc dec -> Bool Source #

(/=) :: LinearExt loc dec -> LinearExt loc dec -> Bool Source #

(Ord loc, Ord dec) => Ord (LinearExt loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

compare :: LinearExt loc dec -> LinearExt loc dec -> Ordering Source #

(<) :: LinearExt loc dec -> LinearExt loc dec -> Bool Source #

(<=) :: LinearExt loc dec -> LinearExt loc dec -> Bool Source #

(>) :: LinearExt loc dec -> LinearExt loc dec -> Bool Source #

(>=) :: LinearExt loc dec -> LinearExt loc dec -> Bool Source #

max :: LinearExt loc dec -> LinearExt loc dec -> LinearExt loc dec Source #

min :: LinearExt loc dec -> LinearExt loc dec -> LinearExt loc dec Source #

(Out l, Out d, Show l, Show d) => Expression (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type TyOf (LinearExt l d) Source #

type LocOf (LinearExt l d) Source #

Methods

isTrivial :: LinearExt l d -> Bool Source #

(Show l, Out l) => Flattenable (LinearExt l Ty0) Source # 
Instance details

Defined in Gibbon.L0.Syntax

FreeVars (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gFreeVars :: LinearExt l d -> Set Var Source #

HasRenamable E0Ext l d => Renamable (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gRename :: Map Var Var -> LinearExt l d -> LinearExt l d Source #

HasSubstitutableExt E0Ext l d => SubstitutableExt (PreExp E0Ext l d) (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gSubstExt :: Var -> PreExp E0Ext l d -> LinearExt l d -> LinearExt l d Source #

gSubstEExt :: PreExp E0Ext l d -> PreExp E0Ext l d -> LinearExt l d -> LinearExt l d Source #

type Rep (LinearExt loc dec) Source # 
Instance details

Defined in Gibbon.L0.Syntax

type LocOf (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

type LocOf (LinearExt l d) = l
type TyOf (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

type TyOf (LinearExt l d) = d

data TyScheme Source #

Straightforward parametric polymorphism.

Constructors

ForAll [TyVar] Ty0 

Instances

Instances details
Out TyScheme Source # 
Instance details

Defined in Gibbon.L0.Syntax

Generic TyScheme Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type Rep TyScheme :: Type -> Type Source #

Read TyScheme Source # 
Instance details

Defined in Gibbon.L0.Syntax

Show TyScheme Source # 
Instance details

Defined in Gibbon.L0.Syntax

NFData TyScheme Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

rnf :: TyScheme -> () Source #

Eq TyScheme Source # 
Instance details

Defined in Gibbon.L0.Syntax

Ord TyScheme Source # 
Instance details

Defined in Gibbon.L0.Syntax

Pretty TyScheme Source # 
Instance details

Defined in Gibbon.Pretty

type Rep TyScheme Source # 
Instance details

Defined in Gibbon.L0.Syntax

data MetaTv Source #

Constructors

Meta Int 

Instances

Instances details
Out MetaTv Source # 
Instance details

Defined in Gibbon.L0.Syntax

Generic MetaTv Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type Rep MetaTv :: Type -> Type Source #

Read MetaTv Source # 
Instance details

Defined in Gibbon.L0.Syntax

Show MetaTv Source # 
Instance details

Defined in Gibbon.L0.Syntax

NFData MetaTv Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

rnf :: MetaTv -> () Source #

Eq MetaTv Source # 
Instance details

Defined in Gibbon.L0.Syntax

Ord MetaTv Source # 
Instance details

Defined in Gibbon.L0.Syntax

type Rep MetaTv Source # 
Instance details

Defined in Gibbon.L0.Syntax

type Rep MetaTv = D1 ('MetaData "MetaTv" "Gibbon.L0.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Meta" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

tyVarsInTy :: Ty0 -> [TyVar] Source #

Get the free TyVars from types; no duplicates in result.

metaTvsInTy :: Ty0 -> [MetaTv] Source #

Get the MetaTvs from a type; no duplicates in result.

substTyVar :: Map TyVar Ty0 -> Ty0 -> Ty0 Source #

Replace the specified quantified type variables by given meta type variables.

isValidListElemTy0 :: Ty0 -> Bool Source #

Lists of scalars or flat products of scalars are allowed.

class Expression e => Typeable e where Source #

This is NOT a replacement for any typechecker. This only recover type of an expression given a type-environment. Without this, we cannot have truly generic Flattenable, b/c we need to know the type of an expression before we bind it with a LetE.

Methods

gRecoverType :: DDefs (TyOf e) -> Env2 (TyOf e) -> e -> TyOf e Source #

Instances

Instances details
Typeable (E1Ext () (UrTy ())) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gRecoverType :: DDefs (TyOf (E1Ext () (UrTy ()))) -> Env2 (TyOf (E1Ext () (UrTy ()))) -> E1Ext () (UrTy ()) -> TyOf (E1Ext () (UrTy ())) Source #

Typeable (E2Ext LocArg Ty2) Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

(Out l, Show l, Typeable (E2 l (UrTy l))) => Typeable (E2Ext l (UrTy l)) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gRecoverType :: DDefs (TyOf (E2Ext l (UrTy l))) -> Env2 (TyOf (E2Ext l (UrTy l))) -> E2Ext l (UrTy l) -> TyOf (E2Ext l (UrTy l)) Source #

(Out l, Show l, Typeable (PreExp E3Ext l (UrTy l))) => Typeable (E3Ext l (UrTy l)) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Methods

gRecoverType :: DDefs (TyOf (E3Ext l (UrTy l))) -> Env2 (TyOf (E3Ext l (UrTy l))) -> E3Ext l (UrTy l) -> TyOf (E3Ext l (UrTy l)) Source #

Typeable (PreExp E2Ext LocVar (UrTy LocVar)) Source #

The gRecoverType instance defined in Language.Syntax is incorrect for L2. For the AppE case, it'll just return the type with with the function was defined. However, we want the recovered type to have the locations actually used at the callsites! For example,

add1 :: Tree a -> Tree b add1 = _

... (add1 [loc1, loc2] tr1) ..

in this case, we want the type of (add1 tr1) to be (Tree loc2) and NOT (Tree b). We have to do something similar for variables bound by a pattern match.

Instance details

Defined in Gibbon.L2.Syntax

Out (E2Ext LocArg Ty2) => Typeable (PreExp E2Ext LocArg Ty2) Source #

The gRecoverType instance defined in Language.Syntax is incorrect for L2. For the AppE case, it'll just return the type with with the function was defined. However, we want the recovered type to have the locations actually used at the callsites! For example,

add1 :: Tree a -> Tree b add1 = _

... (add1 [loc1, loc2] tr1) ..

in this case, we want the type of (add1 tr1) to be (Tree loc2) and NOT (Tree b). We have to do something similar for variables bound by a pattern match.

Instance details

Defined in Gibbon.NewL2.Syntax

(Show (), Out (), TyOf (e () (UrTy ())) ~ TyOf (PreExp e () (UrTy ())), FunctionTy (UrTy ()), Typeable (e () (UrTy ()))) => Typeable (PreExp e () (UrTy ())) Source #

A Typeable instance for L1 and L3 (L2 defines it's own)

Instance details

Defined in Gibbon.Language

Methods

gRecoverType :: DDefs (TyOf (PreExp e () (UrTy ()))) -> Env2 (TyOf (PreExp e () (UrTy ()))) -> PreExp e () (UrTy ()) -> TyOf (PreExp e () (UrTy ())) Source #

type Binds e = (Var, [LocOf e], TyOf e, e) Source #

type Tag = Word8 Source #

data Prim ty Source #

Some of these primitives are (temporarily) tagged directly with their return types.

Constructors

AddP 
SubP 
MulP

May need more numeric primitives...

DivP 
ModP

Integer division and modulus

ExpP

Exponentiation

RandP

Generate a random number. Translates to 'rand()' in C.

EqIntP

Equality on Int

LtP 
GtP

(and () for Int's

LtEqP 
GtEqP

and=

FAddP 
FSubP 
FMulP 
FDivP 
FExpP 
FRandP 
EqFloatP 
EqCharP 
FLtP 
FGtP 
FLtEqP 
FGtEqP 
FSqrtP 
IntToFloatP 
FloatToIntP 
FTanP

Translates to 'tan()' in C.

EqSymP

Equality on Sym

EqBenchProgP String 
OrP 
AndP 
MkTrue

Zero argument constructor.

MkFalse

Zero argument constructor.

ErrorP String ty

crash and issue a static error message. To avoid needing inference, this is labeled with a return type.

SizeParam 
IsBig

Check the size of constructors with size.

GetNumProcessors

Return the number of processors

PrintInt

Print an integer to standard out

PrintChar

Print a character to standard out

PrintFloat

Print a floating point number to standard out

PrintBool

Print a boolean to standard out

PrintSym

Print a symbol to standard out

ReadInt

Read an int from standard in

DictInsertP ty

takes dict, k,v; annotated with element type

DictLookupP ty

takes dict,k errors if absent; annotated with element type

DictEmptyP ty

annotated with element type to avoid ambiguity

DictHasKeyP ty

takes dict,k; returns a Bool, annotated with element type

SymSetEmpty

Creates an empty set

SymSetInsert

Inserts a symbol into a set of symbols

SymSetContains

Queries if a symbol is in a set

SymHashEmpty

Create empty hash table of symbols

SymHashInsert

Insert a symbol into a hash table

SymHashLookup

Look up a symbol in a hash table (takes default symbol)

SymHashContains

Queries if a symbol is in a hash

IntHashEmpty

Create empty hash table of integers

IntHashInsert

Insert an integer into a hash table

IntHashLookup

Look up a integer in a hash table (takes default integer)

PDictAllocP ty ty

annotated with element type to avoid ambiguity

PDictInsertP ty ty

takes dict, k, v; annotated with element type

PDictLookupP ty ty

takes dict, k. errors if absent; annotated with element type

PDictHasKeyP ty ty

takes dict,k; returns a Bool, annotated with element type

PDictForkP ty ty

takes dict; returns thread safe safe dicts.

PDictJoinP ty ty

takes 2 dicts; returns a merged dict.

LLAllocP ty 
LLIsEmptyP ty 
LLConsP ty 
LLHeadP ty 
LLTailP ty 
LLFreeP ty

Free the list, and it's data.

LLFree2P ty

Free list struct, but not it's data.

LLCopyP ty

Copy the list node.

VAllocP ty

Allocate a vector

VFreeP ty

Free a vector, and it's data.

VFree2P ty

Free the vector struct, but not it's data.

VLengthP ty

Length of the vector

VNthP ty

Fetch the nth element

VSliceP ty

An efficient slice operation

InplaceVUpdateP ty

Update ith element of the vector

VConcatP ty

Flatten a vector

VSortP ty

A sort primop that accepts a function pointer

InplaceVSortP ty

A sort primop that sorts the array in place

VMergeP ty

ASSUMPTION: the vectors being merged have the same underlying mutable array. This assumption is checked at the type level with a Rank-2 type variable. But this evidence is erased (by the desugarer) by the time we get to L0.

Write3dPpmFile FilePath 
ReadPackedFile (Maybe FilePath) TyCon (Maybe Var) ty

Read (mmap) a binary file containing packed data. This must be annotated with the type of the file being read. The Ty tracks the type as the program evolvels (first PackedTy then CursorTy). The TyCon tracks the original type name. The variable represents the region that this file will be mapped to, and is set by InferLocations.

WritePackedFile FilePath ty

Write a packed value to a file. To enable re-reading this packed value with Gibbon, this primitive gets rid of any absolute pointers in the value. First, it inlines (by copying) any regions pointed to by the packed value. Next, random access nodes are eliminated. We could change them to relative pointers (numeric offsets), but for a first version we can simplify things by getting rid of them completely.

ReadArrayFile (Maybe (FilePath, Int)) ty

Parse a file into a Vector. This is decorated with the element type. If the element type is a struct, like (Int, Int) for example, each line must contain 2 numbers separated by a space. The Int is the number of lines in the file.

RequestEndOf

Conveys a demand for the "end of" some packed value, which is fulfilled by Cursorize. N.B. the argument must be a VarE that refers to a packed value.

RequestSizeOf

Like RequestEndOf but gets the size of a packed value. Assume that the value is written in a contiguous region, and size = end_v - v.

Gensym 

Instances

Instances details
Foldable Prim Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fold :: Monoid m => Prim m -> m Source #

foldMap :: Monoid m => (a -> m) -> Prim a -> m Source #

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

foldr :: (a -> b -> b) -> b -> Prim a -> b Source #

foldr' :: (a -> b -> b) -> b -> Prim a -> b Source #

foldl :: (b -> a -> b) -> b -> Prim a -> b Source #

foldl' :: (b -> a -> b) -> b -> Prim a -> b Source #

foldr1 :: (a -> a -> a) -> Prim a -> a Source #

foldl1 :: (a -> a -> a) -> Prim a -> a Source #

toList :: Prim a -> [a] Source #

null :: Prim a -> Bool Source #

length :: Prim a -> Int Source #

elem :: Eq a => a -> Prim a -> Bool Source #

maximum :: Ord a => Prim a -> a Source #

minimum :: Ord a => Prim a -> a Source #

sum :: Num a => Prim a -> a Source #

product :: Num a => Prim a -> a Source #

Traversable Prim Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

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

sequenceA :: Applicative f => Prim (f a) -> f (Prim a) Source #

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

sequence :: Monad m => Prim (m a) -> m (Prim a) Source #

Functor Prim Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fmap :: (a -> b) -> Prim a -> Prim b Source #

(<$) :: a -> Prim b -> Prim a Source #

Out ty => Out (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

docPrec :: Int -> Prim ty -> Doc Source #

doc :: Prim ty -> Doc Source #

docList :: [Prim ty] -> Doc Source #

Generic (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep (Prim ty) :: Type -> Type Source #

Methods

from :: Prim ty -> Rep (Prim ty) x Source #

to :: Rep (Prim ty) x -> Prim ty Source #

Read ty => Read (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Show ty => Show (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

showsPrec :: Int -> Prim ty -> ShowS Source #

show :: Prim ty -> String Source #

showList :: [Prim ty] -> ShowS Source #

NFData ty => NFData (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: Prim ty -> () Source #

Eq ty => Eq (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

(==) :: Prim ty -> Prim ty -> Bool Source #

(/=) :: Prim ty -> Prim ty -> Bool Source #

Ord ty => Ord (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

compare :: Prim ty -> Prim ty -> Ordering Source #

(<) :: Prim ty -> Prim ty -> Bool Source #

(<=) :: Prim ty -> Prim ty -> Bool Source #

(>) :: Prim ty -> Prim ty -> Bool Source #

(>=) :: Prim ty -> Prim ty -> Bool Source #

max :: Prim ty -> Prim ty -> Prim ty Source #

min :: Prim ty -> Prim ty -> Prim ty Source #

(Show d, Pretty d, Ord d) => Pretty (Prim d) Source # 
Instance details

Defined in Gibbon.Pretty

Corecursive (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

embed :: Base (Prim ty) (Prim ty) -> Prim ty Source #

ana :: (a -> Base (Prim ty) a) -> a -> Prim ty Source #

apo :: (a -> Base (Prim ty) (Either (Prim ty) a)) -> a -> Prim ty Source #

postpro :: Recursive (Prim ty) => (forall b. Base (Prim ty) b -> Base (Prim ty) b) -> (a -> Base (Prim ty) a) -> a -> Prim ty Source #

gpostpro :: (Recursive (Prim ty), Monad m) => (forall b. m (Base (Prim ty) b) -> Base (Prim ty) (m b)) -> (forall c. Base (Prim ty) c -> Base (Prim ty) c) -> (a -> Base (Prim ty) (m a)) -> a -> Prim ty Source #

Recursive (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

project :: Prim ty -> Base (Prim ty) (Prim ty) Source #

cata :: (Base (Prim ty) a -> a) -> Prim ty -> a Source #

para :: (Base (Prim ty) (Prim ty, a) -> a) -> Prim ty -> a Source #

gpara :: (Corecursive (Prim ty), Comonad w) => (forall b. Base (Prim ty) (w b) -> w (Base (Prim ty) b)) -> (Base (Prim ty) (EnvT (Prim ty) w a) -> a) -> Prim ty -> a Source #

prepro :: Corecursive (Prim ty) => (forall b. Base (Prim ty) b -> Base (Prim ty) b) -> (Base (Prim ty) a -> a) -> Prim ty -> a Source #

gprepro :: (Corecursive (Prim ty), Comonad w) => (forall b. Base (Prim ty) (w b) -> w (Base (Prim ty) b)) -> (forall c. Base (Prim ty) c -> Base (Prim ty) c) -> (Base (Prim ty) (w a) -> a) -> Prim ty -> a Source #

type Rep (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep (Prim ty) = D1 ('MetaData "Prim" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) ((((((C1 ('MetaCons "AddP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SubP" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MulP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DivP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ModP" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "ExpP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RandP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EqIntP" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "LtP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "GtP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LtEqP" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "GtEqP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FAddP" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FSubP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FMulP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FDivP" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "FExpP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FRandP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EqFloatP" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "EqCharP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FLtP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FGtP" 'PrefixI 'False) (U1 :: Type -> Type)))))) :+: ((((C1 ('MetaCons "FLtEqP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FGtEqP" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FSqrtP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "IntToFloatP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FloatToIntP" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "FTanP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "EqSymP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EqBenchProgP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))) :+: (C1 ('MetaCons "OrP" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AndP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MkTrue" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "MkFalse" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ErrorP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "SizeParam" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "IsBig" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "GetNumProcessors" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PrintInt" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "PrintChar" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PrintFloat" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PrintBool" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "PrintSym" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ReadInt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DictInsertP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)))))))) :+: (((((C1 ('MetaCons "DictLookupP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "DictEmptyP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty))) :+: (C1 ('MetaCons "DictHasKeyP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "SymSetEmpty" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SymSetInsert" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "SymSetContains" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SymHashEmpty" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SymHashInsert" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "SymHashLookup" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SymHashContains" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntHashEmpty" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "IntHashInsert" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntHashLookup" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PDictAllocP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "PDictInsertP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "PDictLookupP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty))))) :+: ((C1 ('MetaCons "PDictHasKeyP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "PDictForkP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "PDictJoinP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)))) :+: (C1 ('MetaCons "LLAllocP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "LLIsEmptyP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "LLConsP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty))))))) :+: ((((C1 ('MetaCons "LLHeadP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "LLTailP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty))) :+: (C1 ('MetaCons "LLFreeP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "LLFree2P" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "LLCopyP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty))))) :+: ((C1 ('MetaCons "VAllocP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "VFreeP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "VFree2P" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)))) :+: (C1 ('MetaCons "VLengthP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "VNthP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "VSliceP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)))))) :+: (((C1 ('MetaCons "InplaceVUpdateP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "VConcatP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "VSortP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)))) :+: (C1 ('MetaCons "InplaceVSortP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: (C1 ('MetaCons "VMergeP" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "Write3dPpmFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))) :+: ((C1 ('MetaCons "ReadPackedFile" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FilePath)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyCon)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Var)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty))) :+: (C1 ('MetaCons "WritePackedFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)) :+: C1 ('MetaCons "ReadArrayFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (FilePath, Int))) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ty)))) :+: (C1 ('MetaCons "RequestEndOf" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "RequestSizeOf" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Gensym" 'PrefixI 'False) (U1 :: Type -> Type))))))))
type Base (Prim ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Base (Prim ty) = PrimF ty

class Expression e => Interp s e where Source #

Pure Gibbon programs, at any stage of compilation, should always be evaluatable to a unique value. The only side effects are timing.

Methods

gInterpExp :: RunConfig -> ValEnv e -> DDefs (TyOf e) -> FunDefs e -> e -> InterpM s e (Value e) Source #

Instances

Instances details
Interp Store Exp2 Source # 
Instance details

Defined in Gibbon.L2.Interp

Interp () Exp0 Source # 
Instance details

Defined in Gibbon.L0.Interp

Interp () Exp1 Source # 
Instance details

Defined in Gibbon.L1.Interp

class (Show e, Out e, FreeVars e) => Expression e where Source #

A generic interface to expressions found in different phases of the compiler.

Associated Types

type TyOf e Source #

The type representation used in this expression.

type LocOf e Source #

The location (variable) representation used in this expression.

Methods

isTrivial :: e -> Bool Source #

Is an expression considered trivial (duplicatable by the compiler)?

Instances

Instances details
(Out l, Out d, Show l, Show d) => Expression (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type TyOf (E0Ext l d) Source #

type LocOf (E0Ext l d) Source #

Methods

isTrivial :: E0Ext l d -> Bool Source #

(Out l, Out d, Show l, Show d) => Expression (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type TyOf (LinearExt l d) Source #

type LocOf (LinearExt l d) Source #

Methods

isTrivial :: LinearExt l d -> Bool Source #

(Show l, Show d, Out l, Out d) => Expression (E1Ext l d) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Associated Types

type TyOf (E1Ext l d) Source #

type LocOf (E1Ext l d) Source #

Methods

isTrivial :: E1Ext l d -> Bool Source #

(Out l, Out d, Show l, Show d) => Expression (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type TyOf (E2Ext l d) Source #

type LocOf (E2Ext l d) Source #

Methods

isTrivial :: E2Ext l d -> Bool Source #

(Out l, Out d, Show l, Show d) => Expression (E3Ext l d) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Associated Types

type TyOf (E3Ext l d) Source #

type LocOf (E3Ext l d) Source #

Methods

isTrivial :: E3Ext l d -> Bool Source #

(Out l, Show l, Show d, Out d, Expression (e l d)) => Expression (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Language

Associated Types

type TyOf (PreExp e l d) Source #

type LocOf (PreExp e l d) Source #

Methods

isTrivial :: PreExp e l d -> Bool Source #

type DDefs a = Map Var (DDef a) Source #

data DDef a Source #

Data type definitions.

Monomorphism: In the extreme case we can strip packed datatypes of all type parameters, or we can allow them to retain type params but require that they always be fully instantiated to monomorphic types in the context of our monomorphic programs.

Here we allow individual to be marked with whether or not they should be boxed. We say that a regular, pointer-based datatype has all-boxed fields, whereas a fully serialized datatype has no boxed fields.

Constructors

DDef 

Fields

Instances

Instances details
Functor DDef Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fmap :: (a -> b) -> DDef a -> DDef b Source #

(<$) :: a -> DDef b -> DDef a Source #

Out a => Out (DDef a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

docPrec :: Int -> DDef a -> Doc Source #

doc :: DDef a -> Doc Source #

docList :: [DDef a] -> Doc Source #

Generic (DDef a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep (DDef a) :: Type -> Type Source #

Methods

from :: DDef a -> Rep (DDef a) x Source #

to :: Rep (DDef a) x -> DDef a Source #

Read a => Read (DDef a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Show a => Show (DDef a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

showsPrec :: Int -> DDef a -> ShowS Source #

show :: DDef a -> String Source #

showList :: [DDef a] -> ShowS Source #

NFData a => NFData (DDef a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: DDef a -> () Source #

Eq a => Eq (DDef a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

(==) :: DDef a -> DDef a -> Bool Source #

(/=) :: DDef a -> DDef a -> Bool Source #

Ord a => Ord (DDef a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

compare :: DDef a -> DDef a -> Ordering Source #

(<) :: DDef a -> DDef a -> Bool Source #

(<=) :: DDef a -> DDef a -> Bool Source #

(>) :: DDef a -> DDef a -> Bool Source #

(>=) :: DDef a -> DDef a -> Bool Source #

max :: DDef a -> DDef a -> DDef a Source #

min :: DDef a -> DDef a -> DDef a Source #

Pretty ex => Pretty (DDef ex) Source # 
Instance details

Defined in Gibbon.Pretty

type Rep (DDef a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep (DDef a) = D1 ('MetaData "DDef" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "DDef" 'PrefixI 'True) (S1 ('MetaSel ('Just "tyName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: (S1 ('MetaSel ('Just "tyArgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TyVar]) :*: S1 ('MetaSel ('Just "dataCons") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(DataCon, [(IsBoxed, a)])]))))

class (Out (ArrowTy ty), Show (ArrowTy ty)) => FunctionTy ty where Source #

A type family describing function types.

Associated Types

type ArrowTy ty Source #

Methods

inTys :: ArrowTy ty -> [ty] Source #

outTy :: ArrowTy ty -> ty Source #

Instances

Instances details
FunctionTy Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Associated Types

type ArrowTy Ty0 Source #

FunctionTy Ty1 Source # 
Instance details

Defined in Gibbon.L1.Syntax

Associated Types

type ArrowTy Ty1 Source #

FunctionTy Ty2 Source #

Function types know about locations and traversal effects.

Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type ArrowTy Ty2 Source #

FunctionTy Ty2 Source #

Function types know about locations and traversal effects.

Instance details

Defined in Gibbon.NewL2.Syntax

Associated Types

type ArrowTy Ty2 Source #

type FunDefs ex = Map Var (FunDef ex) Source #

A set of top-level recursive function definitions.

data FunDef ex Source #

A function definiton indexed by a type and expression.

Constructors

FunDef 

Fields

Instances

Instances details
(Generic (ArrowTy (TyOf ex)), Out ex, Out (ArrowTy (TyOf ex))) => Out (FunDef ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

docPrec :: Int -> FunDef ex -> Doc Source #

doc :: FunDef ex -> Doc Source #

docList :: [FunDef ex] -> Doc Source #

Generic (FunDef ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep (FunDef ex) :: Type -> Type Source #

Methods

from :: FunDef ex -> Rep (FunDef ex) x Source #

to :: Rep (FunDef ex) x -> FunDef ex Source #

(Read ex, Read (ArrowTy (TyOf ex))) => Read (FunDef ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

(Show ex, Show (ArrowTy (TyOf ex))) => Show (FunDef ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

(Generic (ArrowTy (TyOf ex)), NFData ex, NFData (ArrowTy (TyOf ex))) => NFData (FunDef ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: FunDef ex -> () Source #

(Eq ex, Eq (ArrowTy (TyOf ex))) => Eq (FunDef ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

(==) :: FunDef ex -> FunDef ex -> Bool Source #

(/=) :: FunDef ex -> FunDef ex -> Bool Source #

(Ord ex, Ord (ArrowTy (TyOf ex))) => Ord (FunDef ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

compare :: FunDef ex -> FunDef ex -> Ordering Source #

(<) :: FunDef ex -> FunDef ex -> Bool Source #

(<=) :: FunDef ex -> FunDef ex -> Bool Source #

(>) :: FunDef ex -> FunDef ex -> Bool Source #

(>=) :: FunDef ex -> FunDef ex -> Bool Source #

max :: FunDef ex -> FunDef ex -> FunDef ex Source #

min :: FunDef ex -> FunDef ex -> FunDef ex Source #

HasPretty ex => Pretty (FunDef ex) Source # 
Instance details

Defined in Gibbon.Pretty

type Rep (FunDef ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

data FunMeta Source #

Constructors

FunMeta 

Instances

Instances details
Out FunMeta Source # 
Instance details

Defined in Gibbon.Language.Syntax

Generic FunMeta Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep FunMeta :: Type -> Type Source #

Read FunMeta Source # 
Instance details

Defined in Gibbon.Language.Syntax

Show FunMeta Source # 
Instance details

Defined in Gibbon.Language.Syntax

NFData FunMeta Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: FunMeta -> () Source #

Eq FunMeta Source # 
Instance details

Defined in Gibbon.Language.Syntax

Ord FunMeta Source # 
Instance details

Defined in Gibbon.Language.Syntax

Pretty FunMeta Source # 
Instance details

Defined in Gibbon.Pretty

type Rep FunMeta Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep FunMeta = D1 ('MetaData "FunMeta" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "FunMeta" 'PrefixI 'True) (S1 ('MetaSel ('Just "funRec") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FunRec) :*: (S1 ('MetaSel ('Just "funInline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FunInline) :*: S1 ('MetaSel ('Just "funCanTriggerGC") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

data FunRec Source #

Constructors

Rec 
NotRec 
TailRec 

Instances

Instances details
Out FunRec Source # 
Instance details

Defined in Gibbon.Language.Syntax

Generic FunRec Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep FunRec :: Type -> Type Source #

Read FunRec Source # 
Instance details

Defined in Gibbon.Language.Syntax

Show FunRec Source # 
Instance details

Defined in Gibbon.Language.Syntax

NFData FunRec Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: FunRec -> () Source #

Eq FunRec Source # 
Instance details

Defined in Gibbon.Language.Syntax

Ord FunRec Source # 
Instance details

Defined in Gibbon.Language.Syntax

Pretty FunRec Source # 
Instance details

Defined in Gibbon.Pretty

type Rep FunRec Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep FunRec = D1 ('MetaData "FunRec" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Rec" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NotRec" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TailRec" 'PrefixI 'False) (U1 :: Type -> Type)))

data FunInline Source #

Constructors

Inline 
NoInline 
Inlineable 

Instances

Instances details
Out FunInline Source # 
Instance details

Defined in Gibbon.Language.Syntax

Generic FunInline Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep FunInline :: Type -> Type Source #

Read FunInline Source # 
Instance details

Defined in Gibbon.Language.Syntax

Show FunInline Source # 
Instance details

Defined in Gibbon.Language.Syntax

NFData FunInline Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: FunInline -> () Source #

Eq FunInline Source # 
Instance details

Defined in Gibbon.Language.Syntax

Ord FunInline Source # 
Instance details

Defined in Gibbon.Language.Syntax

Pretty FunInline Source # 
Instance details

Defined in Gibbon.Pretty

type Rep FunInline Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep FunInline = D1 ('MetaData "FunInline" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Inline" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NoInline" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Inlineable" 'PrefixI 'False) (U1 :: Type -> Type)))

data Prog ex Source #

Complete programs include datatype definitions:

For evaluating a complete program, main's type will be an Int or a datatype. For running a pass benchmark, main will be Nothing and we will expect a "benchmark" function definition which consumes an appropriate packed AST datatype.

Constructors

Prog 

Fields

Instances

Instances details
(Generic (ArrowTy (TyOf ex)), Out (ArrowTy (TyOf ex)), Out (TyOf ex), Out ex) => Out (Prog ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

docPrec :: Int -> Prog ex -> Doc Source #

doc :: Prog ex -> Doc Source #

docList :: [Prog ex] -> Doc Source #

Generic (Prog ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep (Prog ex) :: Type -> Type Source #

Methods

from :: Prog ex -> Rep (Prog ex) x Source #

to :: Rep (Prog ex) x -> Prog ex Source #

(Read (TyOf ex), Read ex, Read (ArrowTy (TyOf ex))) => Read (Prog ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

(Show (TyOf ex), Show ex, Show (ArrowTy (TyOf ex))) => Show (Prog ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

showsPrec :: Int -> Prog ex -> ShowS Source #

show :: Prog ex -> String Source #

showList :: [Prog ex] -> ShowS Source #

(NFData (TyOf ex), NFData (ArrowTy (TyOf ex)), NFData ex, Generic (ArrowTy (TyOf ex))) => NFData (Prog ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: Prog ex -> () Source #

(Eq (TyOf ex), Eq ex, Eq (ArrowTy (TyOf ex))) => Eq (Prog ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

(==) :: Prog ex -> Prog ex -> Bool Source #

(/=) :: Prog ex -> Prog ex -> Bool Source #

(Ord (TyOf ex), Ord ex, Ord (ArrowTy (TyOf ex))) => Ord (Prog ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

compare :: Prog ex -> Prog ex -> Ordering Source #

(<) :: Prog ex -> Prog ex -> Bool Source #

(<=) :: Prog ex -> Prog ex -> Bool Source #

(>) :: Prog ex -> Prog ex -> Bool Source #

(>=) :: Prog ex -> Prog ex -> Bool Source #

max :: Prog ex -> Prog ex -> Prog ex Source #

min :: Prog ex -> Prog ex -> Prog ex Source #

HasPretty ex => Pretty (Prog ex) Source # 
Instance details

Defined in Gibbon.Pretty

type Rep (Prog ex) Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep (Prog ex) = D1 ('MetaData "Prog" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Prog" 'PrefixI 'True) (S1 ('MetaSel ('Just "ddefs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (DDefs (TyOf ex))) :*: (S1 ('MetaSel ('Just "fundefs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FunDefs ex)) :*: S1 ('MetaSel ('Just "mainExp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (ex, TyOf ex))))))

type TyEnv a = Map Var a Source #

A simple type environment

data Env2 a Source #

A common currency for a two part environment consisting of function bindings and regular value bindings.

Constructors

Env2 

Fields

Instances

Instances details
(Out a, Out (ArrowTy a)) => Out (Env2 a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

docPrec :: Int -> Env2 a -> Doc Source #

doc :: Env2 a -> Doc Source #

docList :: [Env2 a] -> Doc Source #

Generic (Env2 a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep (Env2 a) :: Type -> Type Source #

Methods

from :: Env2 a -> Rep (Env2 a) x Source #

to :: Rep (Env2 a) x -> Env2 a Source #

(Read (TyOf a), Read a, Read (ArrowTy a)) => Read (Env2 a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

(Show (TyOf a), Show a, Show (ArrowTy a)) => Show (Env2 a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

showsPrec :: Int -> Env2 a -> ShowS Source #

show :: Env2 a -> String Source #

showList :: [Env2 a] -> ShowS Source #

(Eq (TyOf a), Eq a, Eq (ArrowTy a)) => Eq (Env2 a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

(==) :: Env2 a -> Env2 a -> Bool Source #

(/=) :: Env2 a -> Env2 a -> Bool Source #

type Rep (Env2 a) Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep (Env2 a) = D1 ('MetaData "Env2" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Env2" 'PrefixI 'True) (S1 ('MetaSel ('Just "vEnv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TyEnv a)) :*: S1 ('MetaSel ('Just "fEnv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (TyEnv (ArrowTy a)))))

data PreExp (ext :: Type -> Type -> Type) loc dec Source #

The source language. It has pointer-based sums and products, as well as packed algebraic datatypes.

  1. It is parameterized by an a potential extension point.
  2. It is parameterized by loc, the type of locations.
  3. It is parameterized by a decoration, d, attached to every binder.

Constructors

VarE Var

Variable reference

LitE Int

Numeric literal

CharE Char

A character literal

FloatE Double

Floating point literal

LitSymE Var

A quoted symbol literal

AppE Var [loc] [PreExp ext loc dec]

Apply a top-level / first-order function. Instantiate its type schema by providing location-variable arguments, if applicable.

PrimAppE (Prim dec) [PreExp ext loc dec]

Primitive applications don't manipulate locations.

LetE (Var, [loc], dec, PreExp ext loc dec) (PreExp ext loc dec)

One binding at a time. Allows binding a list of implicit *location* return vales from the RHS, plus a single "real" value. This list of implicit returnsb

IfE (PreExp ext loc dec) (PreExp ext loc dec) (PreExp ext loc dec) 
MkProdE [PreExp ext loc dec]

Tuple construction

ProjE Int (PreExp ext loc dec)

Tuple projection.

CaseE (PreExp ext loc dec) [(DataCon, [(Var, loc)], PreExp ext loc dec)]

Case on a datatype. Each bound, unpacked variable lives at a fixed, read-only location.

DataConE loc DataCon [PreExp ext loc dec]

Construct data that may unpack some fields. The location argument, if applicable, is the byte location at which to write the tag for the sum type.

TimeIt (PreExp ext loc dec) dec Bool

The boolean being true indicates this TimeIt is really (iterate _) This iterate form is used for criterion-style benchmarking.

WithArenaE Var (PreExp ext loc dec) 
SpawnE Var [loc] [PreExp ext loc dec] 
SyncE 
MapE (Var, dec, PreExp ext loc dec) (PreExp ext loc dec) 
FoldE 

Fields

Ext (ext loc dec)

Extension point for downstream language extensions.

Instances

Instances details
Interp Store Exp2 Source # 
Instance details

Defined in Gibbon.L2.Interp

Interp () Exp0 Source # 
Instance details

Defined in Gibbon.L0.Interp

Interp () Exp1 Source # 
Instance details

Defined in Gibbon.L1.Interp

InterpProg Store Exp2 Source # 
Instance details

Defined in Gibbon.L2.Interp

InterpProg () Exp0 Source # 
Instance details

Defined in Gibbon.L0.Interp

InterpProg () Exp1 Source # 
Instance details

Defined in Gibbon.L1.Interp

InterpExt Store Exp2 (E2Ext LocVar Ty2) Source # 
Instance details

Defined in Gibbon.L2.Interp

InterpExt () Exp0 (E0Ext Ty0 Ty0) Source # 
Instance details

Defined in Gibbon.L0.Interp

InterpExt () Exp1 (E1Ext () Ty1) Source # 
Instance details

Defined in Gibbon.L1.Interp

Pretty (PreExp e l d) => Pretty [PreExp e l d] Source # 
Instance details

Defined in Gibbon.Pretty

Methods

pprintWithStyle :: PPStyle -> [PreExp e l d] -> Doc Source #

pprint :: [PreExp e l d] -> Doc Source #

Foldable (ext loc) => Foldable (PreExp ext loc) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fold :: Monoid m => PreExp ext loc m -> m Source #

foldMap :: Monoid m => (a -> m) -> PreExp ext loc a -> m Source #

foldMap' :: Monoid m => (a -> m) -> PreExp ext loc a -> m Source #

foldr :: (a -> b -> b) -> b -> PreExp ext loc a -> b Source #

foldr' :: (a -> b -> b) -> b -> PreExp ext loc a -> b Source #

foldl :: (b -> a -> b) -> b -> PreExp ext loc a -> b Source #

foldl' :: (b -> a -> b) -> b -> PreExp ext loc a -> b Source #

foldr1 :: (a -> a -> a) -> PreExp ext loc a -> a Source #

foldl1 :: (a -> a -> a) -> PreExp ext loc a -> a Source #

toList :: PreExp ext loc a -> [a] Source #

null :: PreExp ext loc a -> Bool Source #

length :: PreExp ext loc a -> Int Source #

elem :: Eq a => a -> PreExp ext loc a -> Bool Source #

maximum :: Ord a => PreExp ext loc a -> a Source #

minimum :: Ord a => PreExp ext loc a -> a Source #

sum :: Num a => PreExp ext loc a -> a Source #

product :: Num a => PreExp ext loc a -> a Source #

Traversable (ext loc) => Traversable (PreExp ext loc) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> PreExp ext loc a -> f (PreExp ext loc b) Source #

sequenceA :: Applicative f => PreExp ext loc (f a) -> f (PreExp ext loc a) Source #

mapM :: Monad m => (a -> m b) -> PreExp ext loc a -> m (PreExp ext loc b) Source #

sequence :: Monad m => PreExp ext loc (m a) -> m (PreExp ext loc a) Source #

Functor (ext loc) => Functor (PreExp ext loc) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fmap :: (a -> b) -> PreExp ext loc a -> PreExp ext loc b Source #

(<$) :: a -> PreExp ext loc b -> PreExp ext loc a Source #

(Out loc, Out dec, Out (ext loc dec)) => Out (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

docPrec :: Int -> PreExp ext loc dec -> Doc Source #

doc :: PreExp ext loc dec -> Doc Source #

docList :: [PreExp ext loc dec] -> Doc Source #

Generic (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep (PreExp ext loc dec) :: Type -> Type Source #

Methods

from :: PreExp ext loc dec -> Rep (PreExp ext loc dec) x Source #

to :: Rep (PreExp ext loc dec) x -> PreExp ext loc dec Source #

(Read loc, Read dec, Read (ext loc dec)) => Read (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

readsPrec :: Int -> ReadS (PreExp ext loc dec) Source #

readList :: ReadS [PreExp ext loc dec] Source #

readPrec :: ReadPrec (PreExp ext loc dec) Source #

readListPrec :: ReadPrec [PreExp ext loc dec] Source #

(Show loc, Show dec, Show (ext loc dec)) => Show (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

showsPrec :: Int -> PreExp ext loc dec -> ShowS Source #

show :: PreExp ext loc dec -> String Source #

showList :: [PreExp ext loc dec] -> ShowS Source #

(NFData loc, NFData dec, NFData (ext loc dec)) => NFData (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: PreExp ext loc dec -> () Source #

(Eq loc, Eq dec, Eq (ext loc dec)) => Eq (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

(==) :: PreExp ext loc dec -> PreExp ext loc dec -> Bool Source #

(/=) :: PreExp ext loc dec -> PreExp ext loc dec -> Bool Source #

(Ord loc, Ord dec, Ord (ext loc dec)) => Ord (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

compare :: PreExp ext loc dec -> PreExp ext loc dec -> Ordering Source #

(<) :: PreExp ext loc dec -> PreExp ext loc dec -> Bool Source #

(<=) :: PreExp ext loc dec -> PreExp ext loc dec -> Bool Source #

(>) :: PreExp ext loc dec -> PreExp ext loc dec -> Bool Source #

(>=) :: PreExp ext loc dec -> PreExp ext loc dec -> Bool Source #

max :: PreExp ext loc dec -> PreExp ext loc dec -> PreExp ext loc dec Source #

min :: PreExp ext loc dec -> PreExp ext loc dec -> PreExp ext loc dec Source #

(Out l, Show l, Show d, Out d, Expression (e l d)) => Expression (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Language

Associated Types

type TyOf (PreExp e l d) Source #

type LocOf (PreExp e l d) Source #

Methods

isTrivial :: PreExp e l d -> Bool Source #

FlattenDeps e l d => Flattenable (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Passes.Flatten

Methods

gFlattenExp :: DDefs (TyOf (PreExp e l d)) -> Env2 (TyOf (PreExp e l d)) -> PreExp e l d -> PassM (PreExp e l d) Source #

gFlattenGatherBinds :: DDefs (TyOf (PreExp e l d)) -> Env2 (TyOf (PreExp e l d)) -> PreExp e l d -> PassM ([Binds (PreExp e l d)], PreExp e l d) Source #

FreeVars (e l d) => FreeVars (PreExp e l d) Source #

Free data variables. Does not include function variables, which currently occupy a different namespace. Does not include location/region variables.

Instance details

Defined in Gibbon.Language

Methods

gFreeVars :: PreExp e l d -> Set Var Source #

HasRenamable e l d => Renamable (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Language

Methods

gRename :: Map Var Var -> PreExp e l d -> PreExp e l d Source #

HasSimplifiable e l d => Simplifiable (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Passes.InlineTriv

Methods

gInlineTrivExp :: Map Var (PreExp e l d) -> PreExp e l d -> PreExp e l d Source #

HasSubstitutable e l d => Substitutable (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Language

Methods

gSubst :: Var -> PreExp e l d -> PreExp e l d -> PreExp e l d Source #

gSubstE :: PreExp e l d -> PreExp e l d -> PreExp e l d -> PreExp e l d Source #

Typeable (PreExp E2Ext LocVar (UrTy LocVar)) Source #

The gRecoverType instance defined in Language.Syntax is incorrect for L2. For the AppE case, it'll just return the type with with the function was defined. However, we want the recovered type to have the locations actually used at the callsites! For example,

add1 :: Tree a -> Tree b add1 = _

... (add1 [loc1, loc2] tr1) ..

in this case, we want the type of (add1 tr1) to be (Tree loc2) and NOT (Tree b). We have to do something similar for variables bound by a pattern match.

Instance details

Defined in Gibbon.L2.Syntax

Out (E2Ext LocArg Ty2) => Typeable (PreExp E2Ext LocArg Ty2) Source #

The gRecoverType instance defined in Language.Syntax is incorrect for L2. For the AppE case, it'll just return the type with with the function was defined. However, we want the recovered type to have the locations actually used at the callsites! For example,

add1 :: Tree a -> Tree b add1 = _

... (add1 [loc1, loc2] tr1) ..

in this case, we want the type of (add1 tr1) to be (Tree loc2) and NOT (Tree b). We have to do something similar for variables bound by a pattern match.

Instance details

Defined in Gibbon.NewL2.Syntax

(Show (), Out (), TyOf (e () (UrTy ())) ~ TyOf (PreExp e () (UrTy ())), FunctionTy (UrTy ()), Typeable (e () (UrTy ()))) => Typeable (PreExp e () (UrTy ())) Source #

A Typeable instance for L1 and L3 (L2 defines it's own)

Instance details

Defined in Gibbon.Language

Methods

gRecoverType :: DDefs (TyOf (PreExp e () (UrTy ()))) -> Env2 (TyOf (PreExp e () (UrTy ()))) -> PreExp e () (UrTy ()) -> TyOf (PreExp e () (UrTy ())) Source #

HasPrettyToo e l d => Pretty (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Pretty

Methods

pprintWithStyle :: PPStyle -> PreExp e l d -> Doc Source #

pprint :: PreExp e l d -> Doc Source #

Corecursive (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

embed :: Base (PreExp ext loc dec) (PreExp ext loc dec) -> PreExp ext loc dec Source #

ana :: (a -> Base (PreExp ext loc dec) a) -> a -> PreExp ext loc dec Source #

apo :: (a -> Base (PreExp ext loc dec) (Either (PreExp ext loc dec) a)) -> a -> PreExp ext loc dec Source #

postpro :: Recursive (PreExp ext loc dec) => (forall b. Base (PreExp ext loc dec) b -> Base (PreExp ext loc dec) b) -> (a -> Base (PreExp ext loc dec) a) -> a -> PreExp ext loc dec Source #

gpostpro :: (Recursive (PreExp ext loc dec), Monad m) => (forall b. m (Base (PreExp ext loc dec) b) -> Base (PreExp ext loc dec) (m b)) -> (forall c. Base (PreExp ext loc dec) c -> Base (PreExp ext loc dec) c) -> (a -> Base (PreExp ext loc dec) (m a)) -> a -> PreExp ext loc dec Source #

Recursive (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

project :: PreExp ext loc dec -> Base (PreExp ext loc dec) (PreExp ext loc dec) Source #

cata :: (Base (PreExp ext loc dec) a -> a) -> PreExp ext loc dec -> a Source #

para :: (Base (PreExp ext loc dec) (PreExp ext loc dec, a) -> a) -> PreExp ext loc dec -> a Source #

gpara :: (Corecursive (PreExp ext loc dec), Comonad w) => (forall b. Base (PreExp ext loc dec) (w b) -> w (Base (PreExp ext loc dec) b)) -> (Base (PreExp ext loc dec) (EnvT (PreExp ext loc dec) w a) -> a) -> PreExp ext loc dec -> a Source #

prepro :: Corecursive (PreExp ext loc dec) => (forall b. Base (PreExp ext loc dec) b -> Base (PreExp ext loc dec) b) -> (Base (PreExp ext loc dec) a -> a) -> PreExp ext loc dec -> a Source #

gprepro :: (Corecursive (PreExp ext loc dec), Comonad w) => (forall b. Base (PreExp ext loc dec) (w b) -> w (Base (PreExp ext loc dec) b)) -> (forall c. Base (PreExp ext loc dec) c -> Base (PreExp ext loc dec) c) -> (Base (PreExp ext loc dec) (w a) -> a) -> PreExp ext loc dec -> a Source #

HasSimplifiableExt E1Ext l d => SimplifiableExt (PreExp E1Ext l d) (E1Ext l d) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gInlineTrivExt :: Map Var (PreExp E1Ext l d) -> E1Ext l d -> E1Ext l d Source #

HasSimplifiableExt E2Ext l d => SimplifiableExt (PreExp E2Ext l d) (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gInlineTrivExt :: Map Var (PreExp E2Ext l d) -> E2Ext l d -> E2Ext l d Source #

HasSimplifiableExt E3Ext l d => SimplifiableExt (PreExp E3Ext l d) (E3Ext l d) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Methods

gInlineTrivExt :: Map Var (PreExp E3Ext l d) -> E3Ext l d -> E3Ext l d Source #

HasSubstitutableExt E0Ext l d => SubstitutableExt (PreExp E0Ext l d) (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gSubstExt :: Var -> PreExp E0Ext l d -> E0Ext l d -> E0Ext l d Source #

gSubstEExt :: PreExp E0Ext l d -> PreExp E0Ext l d -> E0Ext l d -> E0Ext l d Source #

HasSubstitutableExt E0Ext l d => SubstitutableExt (PreExp E0Ext l d) (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gSubstExt :: Var -> PreExp E0Ext l d -> LinearExt l d -> LinearExt l d Source #

gSubstEExt :: PreExp E0Ext l d -> PreExp E0Ext l d -> LinearExt l d -> LinearExt l d Source #

HasSubstitutableExt E1Ext l d => SubstitutableExt (PreExp E1Ext l d) (E1Ext l d) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gSubstExt :: Var -> PreExp E1Ext l d -> E1Ext l d -> E1Ext l d Source #

gSubstEExt :: PreExp E1Ext l d -> PreExp E1Ext l d -> E1Ext l d -> E1Ext l d Source #

HasSubstitutableExt E2Ext l d => SubstitutableExt (PreExp E2Ext l d) (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gSubstExt :: Var -> PreExp E2Ext l d -> E2Ext l d -> E2Ext l d Source #

gSubstEExt :: PreExp E2Ext l d -> PreExp E2Ext l d -> E2Ext l d -> E2Ext l d Source #

HasSubstitutableExt E3Ext l d => SubstitutableExt (PreExp E3Ext l d) (E3Ext l d) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Methods

gSubstExt :: Var -> PreExp E3Ext l d -> E3Ext l d -> E3Ext l d Source #

gSubstEExt :: PreExp E3Ext l d -> PreExp E3Ext l d -> E3Ext l d -> E3Ext l d Source #

type Rep (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep (PreExp ext loc dec) = D1 ('MetaData "PreExp" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) ((((C1 ('MetaCons "VarE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var)) :+: C1 ('MetaCons "LitE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "CharE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char)) :+: (C1 ('MetaCons "FloatE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)) :+: C1 ('MetaCons "LitSymE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var))))) :+: ((C1 ('MetaCons "AppE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [loc]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PreExp ext loc dec]))) :+: C1 ('MetaCons "PrimAppE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Prim dec)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PreExp ext loc dec]))) :+: (C1 ('MetaCons "LetE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Var, [loc], dec, PreExp ext loc dec)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec))) :+: (C1 ('MetaCons "IfE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec)))) :+: C1 ('MetaCons "MkProdE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PreExp ext loc dec])))))) :+: (((C1 ('MetaCons "ProjE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec))) :+: C1 ('MetaCons "CaseE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(DataCon, [(Var, loc)], PreExp ext loc dec)]))) :+: (C1 ('MetaCons "DataConE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DataCon) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PreExp ext loc dec]))) :+: (C1 ('MetaCons "TimeIt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 dec) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :+: C1 ('MetaCons "WithArenaE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec)))))) :+: ((C1 ('MetaCons "SpawnE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [loc]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PreExp ext loc dec]))) :+: C1 ('MetaCons "SyncE" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MapE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Var, dec, PreExp ext loc dec)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec))) :+: (C1 ('MetaCons "FoldE" 'PrefixI 'True) (S1 ('MetaSel ('Just "initial") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Var, dec, PreExp ext loc dec)) :*: (S1 ('MetaSel ('Just "iterator") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Var, dec, PreExp ext loc dec)) :*: S1 ('MetaSel ('Just "body") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreExp ext loc dec)))) :+: C1 ('MetaCons "Ext" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ext loc dec))))))))
type LocOf (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Language

type LocOf (PreExp e l d) = l
type TyOf (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Language

type TyOf (PreExp e l d) = d
type Base (PreExp ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Base (PreExp ext loc dec) = PreExpF ext loc dec

data PreExpF (ext :: Type -> Type -> Type) (loc :: Type) (dec :: Type) r Source #

Constructors

VarEF Var 
LitEF Int 
CharEF Char 
FloatEF Double 
LitSymEF Var 
AppEF Var [loc] [r] 
PrimAppEF (Prim dec) [r] 
LetEF (Var, [loc], dec, r) r 
IfEF r r r 
MkProdEF [r] 
ProjEF Int r 
CaseEF r [([Char], [(Var, loc)], r)] 
DataConEF loc [Char] [r] 
TimeItF r dec Bool 
WithArenaEF Var r 
SpawnEF Var [loc] [r] 
SyncEF 
MapEF (Var, dec, r) r 
FoldEF 

Fields

ExtF (ext loc dec) 

Instances

Instances details
Foldable (PreExpF ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fold :: Monoid m => PreExpF ext loc dec m -> m Source #

foldMap :: Monoid m => (a -> m) -> PreExpF ext loc dec a -> m Source #

foldMap' :: Monoid m => (a -> m) -> PreExpF ext loc dec a -> m Source #

foldr :: (a -> b -> b) -> b -> PreExpF ext loc dec a -> b Source #

foldr' :: (a -> b -> b) -> b -> PreExpF ext loc dec a -> b Source #

foldl :: (b -> a -> b) -> b -> PreExpF ext loc dec a -> b Source #

foldl' :: (b -> a -> b) -> b -> PreExpF ext loc dec a -> b Source #

foldr1 :: (a -> a -> a) -> PreExpF ext loc dec a -> a Source #

foldl1 :: (a -> a -> a) -> PreExpF ext loc dec a -> a Source #

toList :: PreExpF ext loc dec a -> [a] Source #

null :: PreExpF ext loc dec a -> Bool Source #

length :: PreExpF ext loc dec a -> Int Source #

elem :: Eq a => a -> PreExpF ext loc dec a -> Bool Source #

maximum :: Ord a => PreExpF ext loc dec a -> a Source #

minimum :: Ord a => PreExpF ext loc dec a -> a Source #

sum :: Num a => PreExpF ext loc dec a -> a Source #

product :: Num a => PreExpF ext loc dec a -> a Source #

Traversable (PreExpF ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> PreExpF ext loc dec a -> f (PreExpF ext loc dec b) Source #

sequenceA :: Applicative f => PreExpF ext loc dec (f a) -> f (PreExpF ext loc dec a) Source #

mapM :: Monad m => (a -> m b) -> PreExpF ext loc dec a -> m (PreExpF ext loc dec b) Source #

sequence :: Monad m => PreExpF ext loc dec (m a) -> m (PreExpF ext loc dec a) Source #

Functor (PreExpF ext loc dec) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fmap :: (a -> b) -> PreExpF ext loc dec a -> PreExpF ext loc dec b Source #

(<$) :: a -> PreExpF ext loc dec b -> PreExpF ext loc dec a Source #

data PrimF (ty :: Type) r Source #

Instances

Instances details
Foldable (PrimF ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fold :: Monoid m => PrimF ty m -> m Source #

foldMap :: Monoid m => (a -> m) -> PrimF ty a -> m Source #

foldMap' :: Monoid m => (a -> m) -> PrimF ty a -> m Source #

foldr :: (a -> b -> b) -> b -> PrimF ty a -> b Source #

foldr' :: (a -> b -> b) -> b -> PrimF ty a -> b Source #

foldl :: (b -> a -> b) -> b -> PrimF ty a -> b Source #

foldl' :: (b -> a -> b) -> b -> PrimF ty a -> b Source #

foldr1 :: (a -> a -> a) -> PrimF ty a -> a Source #

foldl1 :: (a -> a -> a) -> PrimF ty a -> a Source #

toList :: PrimF ty a -> [a] Source #

null :: PrimF ty a -> Bool Source #

length :: PrimF ty a -> Int Source #

elem :: Eq a => a -> PrimF ty a -> Bool Source #

maximum :: Ord a => PrimF ty a -> a Source #

minimum :: Ord a => PrimF ty a -> a Source #

sum :: Num a => PrimF ty a -> a Source #

product :: Num a => PrimF ty a -> a Source #

Traversable (PrimF ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> PrimF ty a -> f (PrimF ty b) Source #

sequenceA :: Applicative f => PrimF ty (f a) -> f (PrimF ty a) Source #

mapM :: Monad m => (a -> m b) -> PrimF ty a -> m (PrimF ty b) Source #

sequence :: Monad m => PrimF ty (m a) -> m (PrimF ty a) Source #

Functor (PrimF ty) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fmap :: (a -> b) -> PrimF ty a -> PrimF ty b Source #

(<$) :: a -> PrimF ty b -> PrimF ty a Source #

data UrTyF (loc :: Type) r Source #

Instances

Instances details
Foldable (UrTyF loc) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fold :: Monoid m => UrTyF loc m -> m Source #

foldMap :: Monoid m => (a -> m) -> UrTyF loc a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UrTyF loc a -> m Source #

foldr :: (a -> b -> b) -> b -> UrTyF loc a -> b Source #

foldr' :: (a -> b -> b) -> b -> UrTyF loc a -> b Source #

foldl :: (b -> a -> b) -> b -> UrTyF loc a -> b Source #

foldl' :: (b -> a -> b) -> b -> UrTyF loc a -> b Source #

foldr1 :: (a -> a -> a) -> UrTyF loc a -> a Source #

foldl1 :: (a -> a -> a) -> UrTyF loc a -> a Source #

toList :: UrTyF loc a -> [a] Source #

null :: UrTyF loc a -> Bool Source #

length :: UrTyF loc a -> Int Source #

elem :: Eq a => a -> UrTyF loc a -> Bool Source #

maximum :: Ord a => UrTyF loc a -> a Source #

minimum :: Ord a => UrTyF loc a -> a Source #

sum :: Num a => UrTyF loc a -> a Source #

product :: Num a => UrTyF loc a -> a Source #

Traversable (UrTyF loc) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

traverse :: Applicative f => (a -> f b) -> UrTyF loc a -> f (UrTyF loc b) Source #

sequenceA :: Applicative f => UrTyF loc (f a) -> f (UrTyF loc a) Source #

mapM :: Monad m => (a -> m b) -> UrTyF loc a -> m (UrTyF loc b) Source #

sequence :: Monad m => UrTyF loc (m a) -> m (UrTyF loc a) Source #

Functor (UrTyF loc) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fmap :: (a -> b) -> UrTyF loc a -> UrTyF loc b Source #

(<$) :: a -> UrTyF loc b -> UrTyF loc a Source #

class FreeVars a where Source #

Expression and program types which support a notion of free variables.

Methods

gFreeVars :: a -> Set Var Source #

Return a set of free TERM variables. Does not return location variables.

Instances

Instances details
FreeVars LocExp Source # 
Instance details

Defined in Gibbon.L2.Syntax

FreeVars LocExp Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

FreeVars a => FreeVars (TyEnv a) Source # 
Instance details

Defined in Gibbon.L0.Typecheck

Methods

gFreeVars :: TyEnv a -> Set Var Source #

FreeVars (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gFreeVars :: E0Ext l d -> Set Var Source #

FreeVars (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gFreeVars :: LinearExt l d -> Set Var Source #

FreeVars (E1Ext l d) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gFreeVars :: E1Ext l d -> Set Var Source #

FreeVars (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gFreeVars :: E2Ext l d -> Set Var Source #

FreeVars (E3Ext l d) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Methods

gFreeVars :: E3Ext l d -> Set Var Source #

FreeVars (e l d) => FreeVars (PreExp e l d) Source #

Free data variables. Does not include function variables, which currently occupy a different namespace. Does not include location/region variables.

Instance details

Defined in Gibbon.Language

Methods

gFreeVars :: PreExp e l d -> Set Var Source #

class Expression e => Flattenable e where Source #

IRs amenable to flattening

Methods

gFlattenExp :: DDefs (TyOf e) -> Env2 (TyOf e) -> e -> PassM e Source #

Process an expression into a fully-flattened expression which typically includes a larger number of temporary, local variable bindings.

gFlattenGatherBinds :: DDefs (TyOf e) -> Env2 (TyOf e) -> e -> PassM ([Binds e], e) Source #

A private method. Gather the bindings from a subexpression, but do not "discharge" them by creating a let expression. They are in order, so later may depend on earlier.

Instances

Instances details
(Show l, Out l) => Flattenable (E0Ext l Ty0) Source # 
Instance details

Defined in Gibbon.L0.Syntax

(Show l, Out l) => Flattenable (LinearExt l Ty0) Source # 
Instance details

Defined in Gibbon.L0.Syntax

(Show l, Show d, Out l, Out d) => Flattenable (E1Ext l d) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gFlattenExp :: DDefs (TyOf (E1Ext l d)) -> Env2 (TyOf (E1Ext l d)) -> E1Ext l d -> PassM (E1Ext l d) Source #

gFlattenGatherBinds :: DDefs (TyOf (E1Ext l d)) -> Env2 (TyOf (E1Ext l d)) -> E1Ext l d -> PassM ([Binds (E1Ext l d)], E1Ext l d) Source #

(Typeable (E2Ext l d), Expression (E2Ext l d), Flattenable (E2 l d)) => Flattenable (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gFlattenExp :: DDefs (TyOf (E2Ext l d)) -> Env2 (TyOf (E2Ext l d)) -> E2Ext l d -> PassM (E2Ext l d) Source #

gFlattenGatherBinds :: DDefs (TyOf (E2Ext l d)) -> Env2 (TyOf (E2Ext l d)) -> E2Ext l d -> PassM ([Binds (E2Ext l d)], E2Ext l d) Source #

(Show l, Out l) => Flattenable (E3Ext l (UrTy l)) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Methods

gFlattenExp :: DDefs (TyOf (E3Ext l (UrTy l))) -> Env2 (TyOf (E3Ext l (UrTy l))) -> E3Ext l (UrTy l) -> PassM (E3Ext l (UrTy l)) Source #

gFlattenGatherBinds :: DDefs (TyOf (E3Ext l (UrTy l))) -> Env2 (TyOf (E3Ext l (UrTy l))) -> E3Ext l (UrTy l) -> PassM ([Binds (E3Ext l (UrTy l))], E3Ext l (UrTy l)) Source #

FlattenDeps e l d => Flattenable (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Passes.Flatten

Methods

gFlattenExp :: DDefs (TyOf (PreExp e l d)) -> Env2 (TyOf (PreExp e l d)) -> PreExp e l d -> PassM (PreExp e l d) Source #

gFlattenGatherBinds :: DDefs (TyOf (PreExp e l d)) -> Env2 (TyOf (PreExp e l d)) -> PreExp e l d -> PassM ([Binds (PreExp e l d)], PreExp e l d) Source #

class Expression e => Simplifiable e where Source #

IRs amenable to simplification/inlineTrivs. Note that there's a separate SimplifiableExt for simplifying extensions. Simplifiable is the only class which makes such a distinction -- b/c when it's simplifying an extension point, the type of the environment would still be 'M.Map Var e', where e is a top-level IR. Right now we don't have a class (and probably don't want to have one as well) which ties an extension point with an IR. Keeping these classes separate works out nicely.

Methods

gInlineTrivExp :: Map Var e -> e -> e Source #

Instances

Instances details
HasSimplifiable e l d => Simplifiable (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Passes.InlineTriv

Methods

gInlineTrivExp :: Map Var (PreExp e l d) -> PreExp e l d -> PreExp e l d Source #

class Expression e => SimplifiableExt e ext where Source #

Methods

gInlineTrivExt :: Map Var e -> ext -> ext Source #

Instances

Instances details
HasSimplifiableExt E1Ext l d => SimplifiableExt (PreExp E1Ext l d) (E1Ext l d) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gInlineTrivExt :: Map Var (PreExp E1Ext l d) -> E1Ext l d -> E1Ext l d Source #

HasSimplifiableExt E2Ext l d => SimplifiableExt (PreExp E2Ext l d) (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gInlineTrivExt :: Map Var (PreExp E2Ext l d) -> E2Ext l d -> E2Ext l d Source #

HasSimplifiableExt E3Ext l d => SimplifiableExt (PreExp E3Ext l d) (E3Ext l d) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Methods

gInlineTrivExt :: Map Var (PreExp E3Ext l d) -> E3Ext l d -> E3Ext l d Source #

class Expression e => Substitutable e where Source #

Generic substitution over expressions.

Methods

gSubst :: Var -> e -> e -> e Source #

gSubstE :: e -> e -> e -> e Source #

Instances

Instances details
HasSubstitutable e l d => Substitutable (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Language

Methods

gSubst :: Var -> PreExp e l d -> PreExp e l d -> PreExp e l d Source #

gSubstE :: PreExp e l d -> PreExp e l d -> PreExp e l d -> PreExp e l d Source #

class Expression e => SubstitutableExt e ext where Source #

Methods

gSubstExt :: Var -> e -> ext -> ext Source #

gSubstEExt :: e -> e -> ext -> ext Source #

Instances

Instances details
HasSubstitutableExt E0Ext l d => SubstitutableExt (PreExp E0Ext l d) (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gSubstExt :: Var -> PreExp E0Ext l d -> E0Ext l d -> E0Ext l d Source #

gSubstEExt :: PreExp E0Ext l d -> PreExp E0Ext l d -> E0Ext l d -> E0Ext l d Source #

HasSubstitutableExt E0Ext l d => SubstitutableExt (PreExp E0Ext l d) (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gSubstExt :: Var -> PreExp E0Ext l d -> LinearExt l d -> LinearExt l d Source #

gSubstEExt :: PreExp E0Ext l d -> PreExp E0Ext l d -> LinearExt l d -> LinearExt l d Source #

HasSubstitutableExt E1Ext l d => SubstitutableExt (PreExp E1Ext l d) (E1Ext l d) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gSubstExt :: Var -> PreExp E1Ext l d -> E1Ext l d -> E1Ext l d Source #

gSubstEExt :: PreExp E1Ext l d -> PreExp E1Ext l d -> E1Ext l d -> E1Ext l d Source #

HasSubstitutableExt E2Ext l d => SubstitutableExt (PreExp E2Ext l d) (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gSubstExt :: Var -> PreExp E2Ext l d -> E2Ext l d -> E2Ext l d Source #

gSubstEExt :: PreExp E2Ext l d -> PreExp E2Ext l d -> E2Ext l d -> E2Ext l d Source #

HasSubstitutableExt E3Ext l d => SubstitutableExt (PreExp E3Ext l d) (E3Ext l d) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Methods

gSubstExt :: Var -> PreExp E3Ext l d -> E3Ext l d -> E3Ext l d Source #

gSubstEExt :: PreExp E3Ext l d -> PreExp E3Ext l d -> E3Ext l d -> E3Ext l d Source #

class Renamable e where Source #

Alpha renaming, without worrying about name capture -- assuming that Freshen has run before!

Methods

gRename :: Map Var Var -> e -> e Source #

Instances

Instances details
Renamable TyVar Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gRename :: Map Var Var -> TyVar -> TyVar Source #

Renamable Var Source # 
Instance details

Defined in Gibbon.Language

Methods

gRename :: Map Var Var -> Var -> Var Source #

Renamable Ty0 Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gRename :: Map Var Var -> Ty0 -> Ty0 Source #

Renamable () Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gRename :: Map Var Var -> () -> () Source #

Renamable a => Renamable (UrTy a) Source # 
Instance details

Defined in Gibbon.Language

Methods

gRename :: Map Var Var -> UrTy a -> UrTy a Source #

HasRenamable E0Ext l d => Renamable (E0Ext l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gRename :: Map Var Var -> E0Ext l d -> E0Ext l d Source #

HasRenamable E0Ext l d => Renamable (LinearExt l d) Source # 
Instance details

Defined in Gibbon.L0.Syntax

Methods

gRename :: Map Var Var -> LinearExt l d -> LinearExt l d Source #

HasRenamable E1Ext l d => Renamable (E1Ext l d) Source # 
Instance details

Defined in Gibbon.L1.Syntax

Methods

gRename :: Map Var Var -> E1Ext l d -> E1Ext l d Source #

HasRenamable E2Ext l d => Renamable (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gRename :: Map Var Var -> E2Ext l d -> E2Ext l d Source #

HasRenamable E3Ext l d => Renamable (E3Ext l d) Source # 
Instance details

Defined in Gibbon.L3.Syntax

Methods

gRename :: Map Var Var -> E3Ext l d -> E3Ext l d Source #

HasRenamable e l d => Renamable (PreExp e l d) Source # 
Instance details

Defined in Gibbon.Language

Methods

gRename :: Map Var Var -> PreExp e l d -> PreExp e l d Source #

type HasSimplifiable e l d = (Show l, Out l, Show d, Out d, Expression (e l d), SimplifiableExt (PreExp e l d) (e l d)) Source #

type HasSimplifiableExt e l d = (Show l, Out l, Show d, Out d, Simplifiable (PreExp e l d)) Source #

type HasSubstitutable e l d = (Expression (e l d), SubstitutableExt (PreExp e l d) (e l d), Eq d, Show d, Out d, Eq l, Show l, Out l, Eq (e l d)) Source #

type HasSubstitutableExt e l d = (Eq d, Show d, Out d, Eq l, Show l, Out l, Substitutable (PreExp e l d)) Source #

type HasRenamable e l d = (Renamable l, Renamable d, Renamable (e l d)) Source #

type HasOut ex = (Out ex, Out (TyOf ex), Out (ArrowTy (TyOf ex))) Source #

type HasShow ex = (Show ex, Show (TyOf ex), Show (ArrowTy (TyOf ex))) Source #

type HasEq ex = (Eq ex, Eq (TyOf ex), Eq (ArrowTy (TyOf ex))) Source #

type HasGeneric ex = (Generic ex, Generic (TyOf ex), Generic (ArrowTy (TyOf ex))) Source #

type HasNFData ex = (NFData ex, NFData (TyOf ex), NFData (ArrowTy (TyOf ex))) Source #

class (Expression e, Expression ext) => InterpExt s e ext where Source #

Methods

gInterpExt :: RunConfig -> ValEnv e -> DDefs (TyOf e) -> FunDefs e -> ext -> InterpM s e (Value e) Source #

Instances

Instances details
InterpExt Store Exp2 (E2Ext LocVar Ty2) Source # 
Instance details

Defined in Gibbon.L2.Interp

InterpExt () Exp0 (E0Ext Ty0 Ty0) Source # 
Instance details

Defined in Gibbon.L0.Interp

InterpExt () Exp1 (E1Ext () Ty1) Source # 
Instance details

Defined in Gibbon.L1.Interp

class Interp s e => InterpProg s e where Source #

Minimal complete definition

gInterpProg

Methods

gInterpProg :: s -> RunConfig -> Prog e -> IO (s, Value e, ByteString) Source #

gInterpNoLogs :: s -> RunConfig -> Prog e -> String Source #

Interpret while ignoring timing constructs, and dropping the corresponding output to stdout.

gInterpWithStdout :: s -> RunConfig -> Prog e -> IO (String, [String]) Source #

Interpret and produce a "log" of output lines, as well as a final, printed result. The output lines include timing information.

data Value e Source #

It's a first order language with simple values.

Constructors

VInt Int 
VChar Char 
VFloat Double 
VSym String 
VBool Bool 
VDict (Map (Value e) (Value e)) 
VProd [Value e] 
VList [Value e] 
VPacked DataCon [Value e] 
VLoc 

Fields

VCursor 

Fields

VPtr

Cursor are a pointer into the Store plus an offset into the Buffer.

Fields

VLam [Var] e (ValEnv e) 
VWrapId Int (Value e)

A wrapper for vectors that wraps the value with an "id". All Inplace* operations use this "id" to update the value in ValEnv.

Instances

Instances details
Out e => Out (Value e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

docPrec :: Int -> Value e -> Doc Source #

doc :: Value e -> Doc Source #

docList :: [Value e] -> Doc Source #

Generic (Value e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Associated Types

type Rep (Value e) :: Type -> Type Source #

Methods

from :: Value e -> Rep (Value e) x Source #

to :: Rep (Value e) x -> Value e Source #

(Ord e, Read e) => Read (Value e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Show e => Show (Value e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

NFData e => NFData (Value e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

rnf :: Value e -> () Source #

Eq e => Eq (Value e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

(==) :: Value e -> Value e -> Bool Source #

(/=) :: Value e -> Value e -> Bool Source #

Ord e => Ord (Value e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

compare :: Value e -> Value e -> Ordering Source #

(<) :: Value e -> Value e -> Bool Source #

(<=) :: Value e -> Value e -> Bool Source #

(>) :: Value e -> Value e -> Bool Source #

(>=) :: Value e -> Value e -> Bool Source #

max :: Value e -> Value e -> Value e Source #

min :: Value e -> Value e -> Value e Source #

type Rep (Value e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

type Rep (Value e) = D1 ('MetaData "Value" "Gibbon.Language.Syntax" "gibbon-0.3-inplace" 'False) (((C1 ('MetaCons "VInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: (C1 ('MetaCons "VChar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char)) :+: C1 ('MetaCons "VFloat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))) :+: ((C1 ('MetaCons "VSym" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "VBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :+: (C1 ('MetaCons "VDict" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (Value e) (Value e)))) :+: C1 ('MetaCons "VProd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Value e]))))) :+: ((C1 ('MetaCons "VList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Value e])) :+: (C1 ('MetaCons "VPacked" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DataCon) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Value e])) :+: C1 ('MetaCons "VLoc" 'PrefixI 'True) (S1 ('MetaSel ('Just "bufID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: S1 ('MetaSel ('Just "offset") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))) :+: ((C1 ('MetaCons "VCursor" 'PrefixI 'True) (S1 ('MetaSel ('Just "bufID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: S1 ('MetaSel ('Just "offset") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "VPtr" 'PrefixI 'True) (S1 ('MetaSel ('Just "bufID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: S1 ('MetaSel ('Just "offset") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :+: (C1 ('MetaCons "VLam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Var]) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 e) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ValEnv e)))) :+: C1 ('MetaCons "VWrapId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Value e)))))))

type ValEnv e = Map Var (Value e) Source #

data InterpM s e a Source #

Instances

Instances details
MonadState s (InterpM s e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

get :: InterpM s e s Source #

put :: s -> InterpM s e () Source #

state :: (s -> (a, s)) -> InterpM s e a Source #

MonadWriter InterpLog (InterpM s e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

writer :: (a, InterpLog) -> InterpM s e a Source #

tell :: InterpLog -> InterpM s e () Source #

listen :: InterpM s e a -> InterpM s e (a, InterpLog) Source #

pass :: InterpM s e (a, InterpLog -> InterpLog) -> InterpM s e a Source #

MonadFail (InterpM a b) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fail :: String -> InterpM a b a0 Source #

MonadIO (InterpM s e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

liftIO :: IO a -> InterpM s e a Source #

Applicative (InterpM s e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

pure :: a -> InterpM s e a Source #

(<*>) :: InterpM s e (a -> b) -> InterpM s e a -> InterpM s e b Source #

liftA2 :: (a -> b -> c) -> InterpM s e a -> InterpM s e b -> InterpM s e c Source #

(*>) :: InterpM s e a -> InterpM s e b -> InterpM s e b Source #

(<*) :: InterpM s e a -> InterpM s e b -> InterpM s e a Source #

Functor (InterpM s e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

fmap :: (a -> b) -> InterpM s e a -> InterpM s e b Source #

(<$) :: a -> InterpM s e b -> InterpM s e a Source #

Monad (InterpM s e) Source # 
Instance details

Defined in Gibbon.Language.Syntax

Methods

(>>=) :: InterpM s e a -> (a -> InterpM s e b) -> InterpM s e b Source #

(>>) :: InterpM s e a -> InterpM s e b -> InterpM s e b Source #

return :: a -> InterpM s e a Source #

mapExt :: (e1 l d -> e2 l d) -> PreExp e1 l d -> PreExp e2 l d Source #

Apply a function to the extension points only.

mapLocs :: (e l2 d -> e l2 d) -> PreExp e l2 d -> PreExp e l2 d Source #

Apply a function to the locations only.

mapExprs :: (e -> e) -> Prog e -> Prog e Source #

Transform the expressions within a program.

mapMExprs :: Monad m => (e -> m e) -> Prog e -> m (Prog e) Source #

Monadic mapExprs.

visitExp :: forall l1 l2 e1 e2 d1 d2. (l1 -> l2) -> (e1 l1 d1 -> e2 l2 d2) -> (d1 -> d2) -> PreExp e1 l1 d1 -> PreExp e2 l2 d2 Source #

Apply a function to the locations, extensions, and binder-decorations, respectively.

subst :: HasSubstitutable e l d => Var -> PreExp e l d -> PreExp e l d -> PreExp e l d Source #

Substitute an expression in place of a variable.

substE :: HasSubstitutable e l d => PreExp e l d -> PreExp e l d -> PreExp e l d -> PreExp e l d Source #

Expensive subst that looks for a whole matching sub-EXPRESSION. If the old expression is a variable, this still avoids going under binder.

hasTimeIt :: PreExp e l d -> Bool Source #

Does the expression contain a TimeIt form?

hasSpawns :: PreExp e l d -> Bool Source #

Does the expression contain a SpawnE form?

projNonFirst :: (Out l, Out d, Out (e l d)) => Int -> PreExp e l d -> PreExp e l d Source #

Project something which had better not be the first thing in a tuple.

mkProj :: Int -> PreExp e l d -> PreExp e l d Source #

Smart constructor that immediately destroys products if it can: Does NOT avoid single-element tuples.

mkProd :: [PreExp e l d] -> PreExp e l d Source #

Make a product type while avoiding unary products.

mkLets :: [(Var, [loc], dec, PreExp ext loc dec)] -> PreExp ext loc dec -> PreExp ext loc dec Source #

Make a nested series of lets.

flatLets :: [(Var, [l], d, PreExp e l d)] -> PreExp e l d -> PreExp e l d Source #

Alternative version of L1.mkLets that also flattens

tuplizeRefs :: Var -> [Var] -> [d] -> PreExp e l d -> PreExp e l d Source #

mkProdTy :: [UrTy a] -> UrTy a Source #

Same as mkProd, at the type level

projTy :: Out a => Int -> UrTy a -> UrTy a Source #

voidTy :: UrTy a Source #

A makeshift void type.

isProdTy :: UrTy a -> Bool Source #

Are values of this type tuples ?

isNestedProdTy :: UrTy a -> Bool Source #

Do values of this type contain nested tuples ?

isPackedTy :: UrTy a -> Bool Source #

Are values of this type Packed ?

hasPacked :: Show a => UrTy a -> Bool Source #

Do values of this type contain packed data?

sizeOfTy :: UrTy a -> Maybe Int Source #

Provide a size in bytes, if it is statically known.

primArgsTy :: Prim (UrTy a) -> [UrTy a] Source #

Type of the arguments for a primitive operation.

primRetTy :: Prim (UrTy a) -> UrTy a Source #

Return type for a primitive operation.

tyToDataCon :: Show a => UrTy a -> DataCon Source #

Get the data constructor type from a type, failing if it's not packed

isValidListElemTy :: UrTy a -> Bool Source #

Lists of scalars or flat products of scalars are allowed.

getPackedTys :: Show a => UrTy a -> [UrTy a] Source #

Get all packed types in a type.

assertTriv :: (HasCallStack, Expression e) => e -> a -> a Source #

Ensure that an expression is trivial.

assertTrivs :: (HasCallStack, Expression e) => [e] -> a -> a Source #

List version of assertTriv.

lookupDDef :: Out a => DDefs a -> TyCon -> DDef a Source #

Lookup a ddef in its entirety

getConOrdering :: Out a => DDefs a -> TyCon -> [DataCon] Source #

Get the canonical ordering for data constructors, currently based on ordering in the original source code. Takes a TyCon as argument.

getTyOfDataCon :: Out a => DDefs a -> DataCon -> TyCon Source #

Lookup the name of the TyCon that goes with a given DataCon. Must be unique!

lookupDataCon :: Out a => DDefs a -> DataCon -> [a] Source #

Lookup the arguments to a data contstructor.

lkp :: Out a => DDefs a -> DataCon -> (Var, (DataCon, [(IsBoxed, a)])) Source #

Lookup a Datacon. Return (TyCon, (DataCon, [flds]))

lookupDataCon' :: Out a => DDef a -> DataCon -> [a] Source #

Like lookupDataCon but lookup arguments to a data contstructor for a specific instance of a datatype.

lookupDataCon' (Maybe Int) Just = [Int]

insertDD :: DDef a -> DDefs a -> DDefs a Source #

isVoidDDef :: DDef a -> Bool Source #

Is this an empty type (like 'data Void' in Haskell) ?

insertFD :: FunDef ex -> FunDefs ex -> FunDefs ex Source #

Insert a FunDef into FunDefs. Raise an error if a function with the same name already exists.

fromListFD :: [FunDef ex] -> FunDefs ex Source #

 

progToEnv :: Prog a -> Env2 (TyOf a) Source #

Abstract some of the differences of top level program types, by having a common way to extract an initial environment. The initial environment has types only for functions.

getFunTy :: Var -> Prog ex -> ArrowTy (TyOf ex) Source #

Look up the input/output type of a top-level function binding.

extendVEnv :: Var -> a -> Env2 a -> Env2 a Source #

Extend non-function value environment.

extendsVEnv :: Map Var a -> Env2 a -> Env2 a Source #

Extend multiple times in one go.

lookupVEnv :: Out a => Var -> Env2 a -> a Source #

extendFEnv :: Var -> ArrowTy a -> Env2 a -> Env2 a Source #

Extend function type environment.

runInterpM :: InterpM s e a -> s -> IO (a, InterpLog, s) Source #

execAndPrint :: InterpProg s ex => s -> RunConfig -> Prog ex -> IO () Source #

mkUnpackerName :: TyCon -> Var Source #

Map a DataCon onto the name of the generated unpack function.

mkPrinterName :: TyCon -> Var Source #

Map a DataCon onto the name of the generated print function.

Orphan instances

Out Loc Source # 
Instance details

Methods

docPrec :: Int -> Loc -> Doc Source #

doc :: Loc -> Doc Source #

docList :: [Loc] -> Doc Source #

Out Pos Source # 
Instance details

Methods

docPrec :: Int -> Pos -> Doc Source #

doc :: Pos -> Doc Source #

docList :: [Pos] -> Doc Source #

Generic Loc Source # 
Instance details

Associated Types

type Rep Loc :: Type -> Type Source #

Methods

from :: Loc -> Rep Loc x Source #

to :: Rep Loc x -> Loc Source #

Generic Pos Source # 
Instance details

Associated Types

type Rep Pos :: Type -> Type Source #

Methods

from :: Pos -> Rep Pos x Source #

to :: Rep Pos x -> Pos Source #

NFData Loc Source # 
Instance details

Methods

rnf :: Loc -> () Source #

NFData Pos Source # 
Instance details

Methods

rnf :: Pos -> () Source #

Renamable TyVar Source # 
Instance details

Methods

gRename :: Map Var Var -> TyVar -> TyVar Source #

Read t => Read (L t) Source #

Orphaned instance: read without source locations.

Instance details