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

Safe Haskell | None

Agda.Compiler.Epic.Primitive

Description

Change constructors and cases on builtins and natish datatypes to use primitive data

Synopsis

- data PrimTransform = PrimTF {
  - mapCon :: Map QName Var
  - translateCase :: Expr -> [Branch] -> Expr
  }
- prZero :: Var
- prNatEquality :: Var
- prPred :: Var
- prFalse :: Var
- prTrue :: Var
- prSuc :: Var
- primitivise :: [Fun] -> Compile TCM [Fun]
- initialPrims :: Compile TCM ()
- getBuiltins :: Compile TCM [PrimTransform]
- defName :: Term -> QName
- head'' :: [t] -> t -> t
- natPrimTF :: ForcedArgs -> [QName] -> PrimTransform
- primNatCaseZS :: Expr -> Expr -> Var -> Expr -> Expr
- primNatCaseZD :: Expr -> Expr -> Expr -> Expr
- boolPrimTF :: [QName] -> PrimTransform
- primFun :: [PrimTransform] -> Fun -> Compile TCM Fun
- primExpr :: [PrimTransform] -> Expr -> Compile TCM Expr

# Documentation

data PrimTransform

Constructors

PrimTF |
Fields mapCon :: Map QName Var translateCase :: Expr -> [Branch] -> Expr

prZero :: Var

prNatEquality :: Var

prPred :: Var

prFalse :: Var

prTrue :: Var

prSuc :: Var

primitivise :: [Fun] -> Compile TCM [Fun]

Change constructors and cases on builtins and natish datatypes to use primitive data

initialPrims :: Compile TCM ()

Map primitive constructors to primitive tags

getBuiltins :: Compile TCM [PrimTransform]

Build transforms using the names of builtins

defName :: Term -> QName

head'' :: [t] -> t -> t

natPrimTF :: ForcedArgs -> [QName] -> PrimTransform

Translation to primitive integer functions

primNatCaseZS

Arguments

:: Expr | Expression that is cased on
-> Expr | Expression for the zero branch
-> Var | Variable that is bound in suc branch
-> Expr | Expression used for suc branch
-> Expr | Result?

Corresponds to a case for natural numbers

primNatCaseZD

Arguments

:: Expr | Expression that is cased on
-> Expr | Zero branch
-> Expr | Default branch
-> Expr | Result?

Corresponds to a case with a zero and default branch

boolPrimTF :: [QName] -> PrimTransform

Translation to primitive bool functions

primFun :: [PrimTransform] -> Fun -> Compile TCM Fun

Change all the primitives in the function using the PrimTransform

primExpr :: [PrimTransform] -> Expr -> Compile TCM Expr

Change all the primitives in an expression using PrimTransform