Agda-2.6.2.2: A dependently typed functional programming language and proof assistant

Safe Haskell | Safe-Inferred
Language | Haskell2010

Agda.Syntax.Treeless

Description

The treeless syntax is intended to be used as input for the compiler backends. It is more low-level than Internal syntax and is not used for type checking.

Some of the features of treeless syntax are: - case expressions instead of case trees - no instantiated datatypes / constructors

Synopsis

- module Agda.Syntax.Abstract.Name
- class Unreachable a where
  - isUnreachable :: a -> Bool
- data TError
  - = TUnreachable
  - | TMeta String
- data TAlt
  - = TACon {
    - aCon :: QName
    - aArity :: Int
    - aBody :: TTerm
    }
  - | TAGuard {
    - aGuard :: TTerm
    - aBody :: TTerm
    }
  - | TALit {
    - aLit :: Literal
    - aBody :: TTerm
    }
- data CaseInfo = CaseInfo {
  - caseLazy :: Bool
  - caseType :: CaseType
  }
- data CaseType
  - = CTData Quantity QName
  - | CTNat
  - | CTInt
  - | CTChar
  - | CTString
  - | CTFloat
  - | CTQName
- data TPrim
  - = PAdd
  - | PAdd64
  - | PSub
  - | PSub64
  - | PMul
  - | PMul64
  - | PQuot
  - | PQuot64
  - | PRem
  - | PRem64
  - | PGeq
  - | PLt
  - | PLt64
  - | PEqI
  - | PEq64
  - | PEqF
  - | PEqS
  - | PEqC
  - | PEqQ
  - | PIf
  - | PSeq
  - | PITo64
  - | P64ToI
- data TTerm
  - = TVar Int
  - | TPrim TPrim
  - | TDef QName
  - | TApp TTerm Args
  - | TLam TTerm
  - | TLit Literal
  - | TCon QName
  - | TLet TTerm TTerm
  - | TCase Int CaseInfo TTerm [TAlt]
  - | TUnit
  - | TSort
  - | TErased
  - | TCoerce TTerm
  - | TError TError
- type Args = [TTerm]
- data EvaluationStrategy
  - = LazyEvaluation
  - | EagerEvaluation
- data ArgUsage
  - = ArgUsed
  - | ArgUnused
- data Compiled = Compiled {
  - cTreeless :: TTerm
  - cArgUsage :: Maybe [ArgUsage]
  }
- pattern TPFn :: TPrim -> TTerm -> TTerm
- pattern TPOp :: TPrim -> TTerm -> TTerm -> TTerm
- isPrimEq :: TPrim -> Bool
- coerceView :: TTerm -> (Bool, TTerm)
- mkTApp :: TTerm -> Args -> TTerm
- tAppView :: TTerm -> (TTerm, [TTerm])
- coerceAppView :: TTerm -> ((Bool, TTerm), [TTerm])
- tLetView :: TTerm -> ([TTerm], TTerm)
- tLamView :: TTerm -> (Int, TTerm)
- mkTLam :: Int -> TTerm -> TTerm
- mkLet :: TTerm -> TTerm -> TTerm
- tInt :: Integer -> TTerm
- intView :: TTerm -> Maybe Integer
- word64View :: TTerm -> Maybe Word64
- tPlusK :: Integer -> TTerm -> TTerm
- tNegPlusK :: Integer -> TTerm -> TTerm
- plusKView :: TTerm -> Maybe (Integer, TTerm)
- negPlusKView :: TTerm -> Maybe (Integer, TTerm)
- tOp :: TPrim -> TTerm -> TTerm -> TTerm
- tUnreachable :: TTerm
- tIfThenElse :: TTerm -> TTerm -> TTerm -> TTerm
- filterUsed :: [ArgUsage] -> [a] -> [a]

# Documentation

module Agda.Syntax.Abstract.Name

class Unreachable a where Source #

Methods

isUnreachable :: a -> Bool Source #

Checks if the given expression is unreachable or not.

#### Instances

Instances details

Unreachable TAlt Source # |
Instance details Defined in Agda.Syntax.Treeless Methods isUnreachable :: TAlt -> Bool Source #
Unreachable TTerm Source # |
Instance details Defined in Agda.Syntax.Treeless Methods isUnreachable :: TTerm -> Bool Source #

data TError Source #

Constructors

TUnreachable | Code which is unreachable. E.g. absurd branches or missing case defaults. Runtime behaviour of unreachable code is undefined, but preferably the program will exit with an error message. The compiler is free to assume that this code is unreachable and to remove it.
TMeta String | Code which could not be obtained because of a hole in the program. This should throw a runtime error. The string gives some information about the meta variable that got compiled.

#### Instances

Instances details

Data TError Source # |

Instance details

Defined in Agda.Syntax.Treeless

Methods

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

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

toConstr :: TError -> Constr Source #

dataTypeOf :: TError -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic TError Source # |
Instance details Defined in Agda.Syntax.Treeless Associated Types type Rep TError :: Type -> Type Source # Methods from :: TError -> Rep TError x Source # to :: Rep TError x -> TError Source #
Show TError Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> TError -> ShowS Source # show :: TError -> String Source # showList :: [TError] -> ShowS Source #
NFData TError Source # |
Instance details Defined in Agda.Syntax.Treeless Methods rnf :: TError -> () Source #
Eq TError Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: TError -> TError -> Bool Source # (/=) :: TError -> TError -> Bool Source #
Ord TError Source # |
Instance details Defined in Agda.Syntax.Treeless Methods compare :: TError -> TError -> Ordering Source # (<) :: TError -> TError -> Bool Source # (<=) :: TError -> TError -> Bool Source # (>) :: TError -> TError -> Bool Source # (>=) :: TError -> TError -> Bool Source # max :: TError -> TError -> TError Source # min :: TError -> TError -> TError Source #
type Rep TError Source # |
Instance details Defined in Agda.Syntax.Treeless type Rep TError = D1 ('MetaData "TError" "Agda.Syntax.Treeless" "Agda-2.6.2.2-7KnEKyKhaJHFPwDzdI3vIK" 'False) (C1 ('MetaCons "TUnreachable" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TMeta" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

data TAlt Source #

Constructors

TACon | Matches on the given constructor. If the match succeeds, the pattern variables are prepended to the current environment (pushes all existing variables aArity steps further away)

Fields

- aCon :: QName
- aArity :: Int
- aBody :: TTerm

TAGuard | Binds no variables

Fields

- aGuard :: TTerm
- aBody :: TTerm

TALit |

Fields

- aLit :: Literal
- aBody :: TTerm

#### Instances

Instances details

HasFree TAlt Source # |
Instance details Defined in Agda.Compiler.Treeless.Subst Methods freeVars :: TAlt -> Map Int Occurs Source #
Unreachable TAlt Source # |
Instance details Defined in Agda.Syntax.Treeless Methods isUnreachable :: TAlt -> Bool Source #
Subst TAlt Source # |
Instance details Defined in Agda.Compiler.Treeless.Subst Associated Types type SubstArg TAlt Source # Methods applySubst :: Substitution' (SubstArg TAlt) -> TAlt -> TAlt Source #
Data TAlt Source # |

Instance details

Defined in Agda.Syntax.Treeless

Methods

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

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

toConstr :: TAlt -> Constr Source #

dataTypeOf :: TAlt -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic TAlt Source # |
Instance details Defined in Agda.Syntax.Treeless Associated Types type Rep TAlt :: Type -> Type Source # Methods from :: TAlt -> Rep TAlt x Source # to :: Rep TAlt x -> TAlt Source #
Show TAlt Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> TAlt -> ShowS Source # show :: TAlt -> String Source # showList :: [TAlt] -> ShowS Source #
NFData TAlt Source # |
Instance details Defined in Agda.Syntax.Treeless Methods rnf :: TAlt -> () Source #
Eq TAlt Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: TAlt -> TAlt -> Bool Source # (/=) :: TAlt -> TAlt -> Bool Source #
Ord TAlt Source # |
Instance details Defined in Agda.Syntax.Treeless Methods compare :: TAlt -> TAlt -> Ordering Source # (<) :: TAlt -> TAlt -> Bool Source # (<=) :: TAlt -> TAlt -> Bool Source # (>) :: TAlt -> TAlt -> Bool Source # (>=) :: TAlt -> TAlt -> Bool Source # max :: TAlt -> TAlt -> TAlt Source # min :: TAlt -> TAlt -> TAlt Source #
type SubstArg TAlt Source # |
Instance details Defined in Agda.Compiler.Treeless.Subst type SubstArg TAlt = TTerm
type Rep TAlt Source # |

Instance details

Defined in Agda.Syntax.Treeless

type Rep TAlt = D1 ('MetaData "TAlt" "Agda.Syntax.Treeless" "Agda-2.6.2.2-7KnEKyKhaJHFPwDzdI3vIK" 'False) (C1 ('MetaCons "TACon" 'PrefixI 'True) (S1 ('MetaSel ('Just "aCon") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName) :*: (S1 ('MetaSel ('Just "aArity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "aBody") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm))) :+: (C1 ('MetaCons "TAGuard" 'PrefixI 'True) (S1 ('MetaSel ('Just "aGuard") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm) :*: S1 ('MetaSel ('Just "aBody") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm)) :+: C1 ('MetaCons "TALit" 'PrefixI 'True) (S1 ('MetaSel ('Just "aLit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Literal) :*: S1 ('MetaSel ('Just "aBody") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm))))

data CaseInfo Source #

Constructors

CaseInfo |

Fields

- caseLazy :: Bool
- caseType :: CaseType

#### Instances

Instances details

Data CaseInfo Source # |

Instance details

Defined in Agda.Syntax.Treeless

Methods

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

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

toConstr :: CaseInfo -> Constr Source #

dataTypeOf :: CaseInfo -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic CaseInfo Source # |
Instance details Defined in Agda.Syntax.Treeless Associated Types type Rep CaseInfo :: Type -> Type Source # Methods from :: CaseInfo -> Rep CaseInfo x Source # to :: Rep CaseInfo x -> CaseInfo Source #
Show CaseInfo Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> CaseInfo -> ShowS Source # show :: CaseInfo -> String Source # showList :: [CaseInfo] -> ShowS Source #
NFData CaseInfo Source # |
Instance details Defined in Agda.Syntax.Treeless Methods rnf :: CaseInfo -> () Source #
Eq CaseInfo Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: CaseInfo -> CaseInfo -> Bool Source # (/=) :: CaseInfo -> CaseInfo -> Bool Source #
Ord CaseInfo Source # |
Instance details Defined in Agda.Syntax.Treeless Methods compare :: CaseInfo -> CaseInfo -> Ordering Source # (<) :: CaseInfo -> CaseInfo -> Bool Source # (<=) :: CaseInfo -> CaseInfo -> Bool Source # (>) :: CaseInfo -> CaseInfo -> Bool Source # (>=) :: CaseInfo -> CaseInfo -> Bool Source # max :: CaseInfo -> CaseInfo -> CaseInfo Source # min :: CaseInfo -> CaseInfo -> CaseInfo Source #
type Rep CaseInfo Source # |

Instance details

Defined in Agda.Syntax.Treeless

type Rep CaseInfo = D1 ('MetaData "CaseInfo" "Agda.Syntax.Treeless" "Agda-2.6.2.2-7KnEKyKhaJHFPwDzdI3vIK" 'False) (C1 ('MetaCons "CaseInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "caseLazy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "caseType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CaseType)))

data CaseType Source #

Constructors

CTData Quantity QName |
CTNat |
CTInt |
CTChar |
CTString |
CTFloat |
CTQName |

#### Instances

Instances details

Data CaseType Source # |

Instance details

Defined in Agda.Syntax.Treeless

Methods

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

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

toConstr :: CaseType -> Constr Source #

dataTypeOf :: CaseType -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic CaseType Source # |
Instance details Defined in Agda.Syntax.Treeless Associated Types type Rep CaseType :: Type -> Type Source # Methods from :: CaseType -> Rep CaseType x Source # to :: Rep CaseType x -> CaseType Source #
Show CaseType Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> CaseType -> ShowS Source # show :: CaseType -> String Source # showList :: [CaseType] -> ShowS Source #
NFData CaseType Source # |
Instance details Defined in Agda.Syntax.Treeless Methods rnf :: CaseType -> () Source #
Eq CaseType Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: CaseType -> CaseType -> Bool Source # (/=) :: CaseType -> CaseType -> Bool Source #
Ord CaseType Source # |
Instance details Defined in Agda.Syntax.Treeless Methods compare :: CaseType -> CaseType -> Ordering Source # (<) :: CaseType -> CaseType -> Bool Source # (<=) :: CaseType -> CaseType -> Bool Source # (>) :: CaseType -> CaseType -> Bool Source # (>=) :: CaseType -> CaseType -> Bool Source # max :: CaseType -> CaseType -> CaseType Source # min :: CaseType -> CaseType -> CaseType Source #
type Rep CaseType Source # |

Instance details

Defined in Agda.Syntax.Treeless

type Rep CaseType = D1 ('MetaData "CaseType" "Agda.Syntax.Treeless" "Agda-2.6.2.2-7KnEKyKhaJHFPwDzdI3vIK" 'False) ((C1 ('MetaCons "CTData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Quantity) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName)) :+: (C1 ('MetaCons "CTNat" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CTInt" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "CTChar" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CTString" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CTFloat" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CTQName" 'PrefixI 'False) (U1 :: Type -> Type))))

data TPrim Source #

Compiler-related primitives. This are NOT the same thing as primitives in Agda's surface or internal syntax! Some of the primitives have a suffix indicating which type of arguments they take, using the following naming convention: Char | Type C | Character F | Float I | Integer Q | QName S | String

Constructors

PAdd |
PAdd64 |
PSub |
PSub64 |
PMul |
PMul64 |
PQuot |
PQuot64 |
PRem |
PRem64 |
PGeq |
PLt |
PLt64 |
PEqI |
PEq64 |
PEqF |
PEqS |
PEqC |
PEqQ |
PIf |
PSeq |
PITo64 |
P64ToI |

#### Instances

Instances details

Data TPrim Source # |

Instance details

Defined in Agda.Syntax.Treeless

Methods

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

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

toConstr :: TPrim -> Constr Source #

dataTypeOf :: TPrim -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic TPrim Source # |
Instance details Defined in Agda.Syntax.Treeless Associated Types type Rep TPrim :: Type -> Type Source # Methods from :: TPrim -> Rep TPrim x Source # to :: Rep TPrim x -> TPrim Source #
Show TPrim Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> TPrim -> ShowS Source # show :: TPrim -> String Source # showList :: [TPrim] -> ShowS Source #
NFData TPrim Source # |
Instance details Defined in Agda.Syntax.Treeless Methods rnf :: TPrim -> () Source #
Eq TPrim Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: TPrim -> TPrim -> Bool Source # (/=) :: TPrim -> TPrim -> Bool Source #
Ord TPrim Source # |
Instance details Defined in Agda.Syntax.Treeless Methods compare :: TPrim -> TPrim -> Ordering Source # (<) :: TPrim -> TPrim -> Bool Source # (<=) :: TPrim -> TPrim -> Bool Source # (>) :: TPrim -> TPrim -> Bool Source # (>=) :: TPrim -> TPrim -> Bool Source # max :: TPrim -> TPrim -> TPrim Source # min :: TPrim -> TPrim -> TPrim Source #
type Rep TPrim Source # |

Instance details

Defined in Agda.Syntax.Treeless

type Rep TPrim = D1 ('MetaData "TPrim" "Agda.Syntax.Treeless" "Agda-2.6.2.2-7KnEKyKhaJHFPwDzdI3vIK" 'False) ((((C1 ('MetaCons "PAdd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PAdd64" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PSub" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PSub64" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PMul" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "PMul64" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PQuot" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PQuot64" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "PRem" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PRem64" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PGeq" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "PLt" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PLt64" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PEqI" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "PEq64" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PEqF" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PEqS" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "PEqC" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PEqQ" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PIf" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "PSeq" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PITo64" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "P64ToI" 'PrefixI 'False) (U1 :: Type -> Type))))))

data TTerm Source #

Constructors

TVar Int |
TPrim TPrim |
TDef QName |
TApp TTerm Args |
TLam TTerm |
TLit Literal |
TCon QName |
TLet TTerm TTerm | introduces a new local binding. The bound term MUST only be evaluated if it is used inside the body. Sharing may happen, but is optional. It is also perfectly valid to just inline the bound term in the body.
TCase Int CaseInfo TTerm [TAlt] | Case scrutinee (always variable), case type, default value, alternatives First, all TACon alternatives are tried; then all TAGuard alternatives in top to bottom order. TACon alternatives must not overlap.
TUnit |
TSort |
TErased |
TCoerce TTerm | Used by the GHC backend
TError TError | A runtime error, something bad has happened.

#### Instances

Instances details

HasFree TTerm Source # |
Instance details Defined in Agda.Compiler.Treeless.Subst Methods freeVars :: TTerm -> Map Int Occurs Source #
Unreachable TTerm Source # |
Instance details Defined in Agda.Syntax.Treeless Methods isUnreachable :: TTerm -> Bool Source #
Subst TTerm Source # |
Instance details Defined in Agda.Compiler.Treeless.Subst Associated Types type SubstArg TTerm Source # Methods applySubst :: Substitution' (SubstArg TTerm) -> TTerm -> TTerm Source #
DeBruijn TTerm Source # |
Instance details Defined in Agda.Compiler.Treeless.Subst Methods deBruijnVar :: Int -> TTerm Source # debruijnNamedVar :: String -> Int -> TTerm Source # deBruijnView :: TTerm -> Maybe Int Source #
Pretty TTerm Source # |
Instance details Defined in Agda.Compiler.Treeless.Pretty Methods pretty :: TTerm -> Doc Source # prettyPrec :: Int -> TTerm -> Doc Source # prettyList :: [TTerm] -> Doc Source #
Data TTerm Source # |

Instance details

Defined in Agda.Syntax.Treeless

Methods

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

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

toConstr :: TTerm -> Constr Source #

dataTypeOf :: TTerm -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic TTerm Source # |
Instance details Defined in Agda.Syntax.Treeless Associated Types type Rep TTerm :: Type -> Type Source # Methods from :: TTerm -> Rep TTerm x Source # to :: Rep TTerm x -> TTerm Source #
Show TTerm Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> TTerm -> ShowS Source # show :: TTerm -> String Source # showList :: [TTerm] -> ShowS Source #
NFData TTerm Source # |
Instance details Defined in Agda.Syntax.Treeless Methods rnf :: TTerm -> () Source #
Eq TTerm Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: TTerm -> TTerm -> Bool Source # (/=) :: TTerm -> TTerm -> Bool Source #
Ord TTerm Source # |
Instance details Defined in Agda.Syntax.Treeless Methods compare :: TTerm -> TTerm -> Ordering Source # (<) :: TTerm -> TTerm -> Bool Source # (<=) :: TTerm -> TTerm -> Bool Source # (>) :: TTerm -> TTerm -> Bool Source # (>=) :: TTerm -> TTerm -> Bool Source # max :: TTerm -> TTerm -> TTerm Source # min :: TTerm -> TTerm -> TTerm Source #
type SubstArg TTerm Source # |
Instance details Defined in Agda.Compiler.Treeless.Subst type SubstArg TTerm = TTerm
type Rep TTerm Source # |

Instance details

Defined in Agda.Syntax.Treeless

type Rep TTerm = D1 ('MetaData "TTerm" "Agda.Syntax.Treeless" "Agda-2.6.2.2-7KnEKyKhaJHFPwDzdI3vIK" 'False) (((C1 ('MetaCons "TVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: (C1 ('MetaCons "TPrim" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TPrim)) :+: C1 ('MetaCons "TDef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName)))) :+: ((C1 ('MetaCons "TApp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Args)) :+: C1 ('MetaCons "TLam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm))) :+: (C1 ('MetaCons "TLit" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Literal)) :+: C1 ('MetaCons "TCon" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QName))))) :+: ((C1 ('MetaCons "TLet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm)) :+: (C1 ('MetaCons "TCase" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CaseInfo)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [TAlt]))) :+: C1 ('MetaCons "TUnit" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "TSort" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TErased" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "TCoerce" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm)) :+: C1 ('MetaCons "TError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TError))))))

type Args = [TTerm] Source #

data EvaluationStrategy Source #

The treeless compiler can behave differently depending on the target language evaluation strategy. For instance, more aggressive erasure for lazy targets.

Constructors

LazyEvaluation |
EagerEvaluation |

#### Instances

Instances details

Show EvaluationStrategy Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> EvaluationStrategy -> ShowS Source # show :: EvaluationStrategy -> String Source # showList :: [EvaluationStrategy] -> ShowS Source #
Eq EvaluationStrategy Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: EvaluationStrategy -> EvaluationStrategy -> Bool Source # (/=) :: EvaluationStrategy -> EvaluationStrategy -> Bool Source #

data ArgUsage Source #

Usage status of function arguments in treeless code.

Constructors

ArgUsed |
ArgUnused |

#### Instances

Instances details

Data ArgUsage Source # |

Instance details

Defined in Agda.Syntax.Treeless

Methods

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

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

toConstr :: ArgUsage -> Constr Source #

dataTypeOf :: ArgUsage -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic ArgUsage Source # |
Instance details Defined in Agda.Syntax.Treeless Associated Types type Rep ArgUsage :: Type -> Type Source # Methods from :: ArgUsage -> Rep ArgUsage x Source # to :: Rep ArgUsage x -> ArgUsage Source #
Show ArgUsage Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> ArgUsage -> ShowS Source # show :: ArgUsage -> String Source # showList :: [ArgUsage] -> ShowS Source #
NFData ArgUsage Source # |
Instance details Defined in Agda.Syntax.Treeless Methods rnf :: ArgUsage -> () Source #
Eq ArgUsage Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: ArgUsage -> ArgUsage -> Bool Source # (/=) :: ArgUsage -> ArgUsage -> Bool Source #
Ord ArgUsage Source # |
Instance details Defined in Agda.Syntax.Treeless Methods compare :: ArgUsage -> ArgUsage -> Ordering Source # (<) :: ArgUsage -> ArgUsage -> Bool Source # (<=) :: ArgUsage -> ArgUsage -> Bool Source # (>) :: ArgUsage -> ArgUsage -> Bool Source # (>=) :: ArgUsage -> ArgUsage -> Bool Source # max :: ArgUsage -> ArgUsage -> ArgUsage Source # min :: ArgUsage -> ArgUsage -> ArgUsage Source #
type Rep ArgUsage Source # |
Instance details Defined in Agda.Syntax.Treeless type Rep ArgUsage = D1 ('MetaData "ArgUsage" "Agda.Syntax.Treeless" "Agda-2.6.2.2-7KnEKyKhaJHFPwDzdI3vIK" 'False) (C1 ('MetaCons "ArgUsed" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ArgUnused" 'PrefixI 'False) (U1 :: Type -> Type))

data Compiled Source #

Constructors

Compiled |

Fields

- cTreeless :: TTerm
- cArgUsage :: Maybe [ArgUsage]

  `Nothing` if treeless usage analysis has not run yet.

#### Instances

Instances details

KillRange Compiled Source # |
Instance details Defined in Agda.Syntax.Treeless Methods killRange :: KillRangeT Compiled Source #
Data Compiled Source # |

Instance details

Defined in Agda.Syntax.Treeless

Methods

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

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

toConstr :: Compiled -> Constr Source #

dataTypeOf :: Compiled -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic Compiled Source # |
Instance details Defined in Agda.Syntax.Treeless Associated Types type Rep Compiled :: Type -> Type Source # Methods from :: Compiled -> Rep Compiled x Source # to :: Rep Compiled x -> Compiled Source #
Show Compiled Source # |
Instance details Defined in Agda.Syntax.Treeless Methods showsPrec :: Int -> Compiled -> ShowS Source # show :: Compiled -> String Source # showList :: [Compiled] -> ShowS Source #
NFData Compiled Source # |
Instance details Defined in Agda.Syntax.Treeless Methods rnf :: Compiled -> () Source #
Eq Compiled Source # |
Instance details Defined in Agda.Syntax.Treeless Methods (==) :: Compiled -> Compiled -> Bool Source # (/=) :: Compiled -> Compiled -> Bool Source #
Ord Compiled Source # |
Instance details Defined in Agda.Syntax.Treeless Methods compare :: Compiled -> Compiled -> Ordering Source # (<) :: Compiled -> Compiled -> Bool Source # (<=) :: Compiled -> Compiled -> Bool Source # (>) :: Compiled -> Compiled -> Bool Source # (>=) :: Compiled -> Compiled -> Bool Source # max :: Compiled -> Compiled -> Compiled Source # min :: Compiled -> Compiled -> Compiled Source #
type Rep Compiled Source # |

Instance details

Defined in Agda.Syntax.Treeless

type Rep Compiled = D1 ('MetaData "Compiled" "Agda.Syntax.Treeless" "Agda-2.6.2.2-7KnEKyKhaJHFPwDzdI3vIK" 'False) (C1 ('MetaCons "Compiled" 'PrefixI 'True) (S1 ('MetaSel ('Just "cTreeless") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TTerm) :*: S1 ('MetaSel ('Just "cArgUsage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [ArgUsage]))))

pattern TPFn :: TPrim -> TTerm -> TTerm Source #

pattern TPOp :: TPrim -> TTerm -> TTerm -> TTerm Source #

isPrimEq :: TPrim -> Bool Source #

coerceView :: TTerm -> (Bool, TTerm) Source #

Strip leading coercions and indicate whether there were some.

mkTApp :: TTerm -> Args -> TTerm Source #

tAppView :: TTerm -> (TTerm, [TTerm]) Source #

coerceAppView :: TTerm -> ((Bool, TTerm), [TTerm]) Source #

Expose the format `coerce f args`.

We fuse coercions, even if interleaving with applications. We assume that coercion is powerful enough to satisfy `coerce (coerce f a) b = coerce f a b`

tLetView :: TTerm -> ([TTerm], TTerm) Source #

tLamView :: TTerm -> (Int, TTerm) Source #

mkTLam :: Int -> TTerm -> TTerm Source #

mkLet :: TTerm -> TTerm -> TTerm Source #

Introduces a new binding

tInt :: Integer -> TTerm Source #

intView :: TTerm -> Maybe Integer Source #

word64View :: TTerm -> Maybe Word64 Source #

tPlusK :: Integer -> TTerm -> TTerm Source #

tNegPlusK :: Integer -> TTerm -> TTerm Source #

plusKView :: TTerm -> Maybe (Integer, TTerm) Source #

negPlusKView :: TTerm -> Maybe (Integer, TTerm) Source #

tOp :: TPrim -> TTerm -> TTerm -> TTerm Source #

tUnreachable :: TTerm Source #

tIfThenElse :: TTerm -> TTerm -> TTerm -> TTerm Source #

filterUsed :: [ArgUsage] -> [a] -> [a] Source #

`filterUsed used args` drops those `args` which are labelled `ArgUnused` in list `used`.

Specification:

      filterUsed used args = [ a | (a, ArgUsed) <- zip args $ used ++ repeat ArgUsed ]

Examples:

      filterUsed []                 == id
      filterUsed (repeat ArgUsed)   == id
      filterUsed (repeat ArgUnused) == const []