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

Agda.TypeChecking.Primitive

Contents

Description

Primitive functions, such as addition on builtin integers.

Synopsis

Documentation

constructorForm :: Term -> TCM Term

Rewrite a literal to constructor form if possible.

Primitive functions

data PrimitiveImpl

Constructors

PrimImpl Type PrimFun 

newtype Str

Constructors

Str 

Fields

unStr :: String
 

newtype Nat

Constructors

Nat 

Fields

unNat :: Integer
 

newtype Lvl

Constructors

Lvl 

Fields

unLvl :: Integer
 

class PrimType a where

Methods

primType :: a -> TCM Type

Instances

buildList :: TCM ([Term] -> Term)

buildList A ts builds a list of type List A. Assumes that the terms ts all have type A.

redBind :: TCM (Reduced a a') -> (a -> b) -> (a' -> TCM (Reduced b b')) -> TCM (Reduced b b')

Conceptually: redBind m f k = either (return . Left . f) k =<< m

redReturn :: a -> TCM (Reduced a' a)

mkPrimFun2 :: (PrimType a, PrimType b, PrimType c, FromTerm a, ToTerm a, FromTerm b, ToTerm c) => (a -> b -> c) -> TCM PrimitiveImpl

mkPrimFun4 :: (PrimType a, FromTerm a, ToTerm a, PrimType b, FromTerm b, ToTerm b, PrimType c, FromTerm c, ToTerm c, PrimType d, FromTerm d, PrimType e, ToTerm e) => (a -> b -> c -> d -> e) -> TCM PrimitiveImpl

The actual primitive functions

type Op a = a -> a -> a

type Fun a = a -> a

type Rel a = a -> a -> Bool

type Pred a = a -> Bool

rebindPrimitive :: String -> TCM PrimFun

Rebind a primitive. Assumes everything is type correct. Used when importing a module with primitives.