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

Safe Haskell | None

Agda.Compiler.Epic.NatDetection

Description

Detect if a datatype could be represented as a primitive integer. If it has one constructor with no arguments and one with a recursive argument this is true. This is done using IrrFilters which filter out forced arguments, so for example Fin becomes primitive.

Synopsis

- getNatish :: Compile TCM [(ForcedArgs, [QName])]
- isNatish :: QName -> Defn -> Compile TCM (Maybe (ForcedArgs, [QName]))
- nrRel :: ForcedArgs -> Integer
- isRec :: Int -> Type -> QName -> Bool
- argIsDef :: Type -> QName -> Bool

# Documentation

getNatish :: Compile TCM [(ForcedArgs, [QName])]

Get a list of all the datatypes that look like nats. The [QName] is on the form [zeroConstr, sucConstr]

isNatish :: QName -> Defn -> Compile TCM (Maybe (ForcedArgs, [QName]))

nrRel :: ForcedArgs -> Integer

Count the number of relevant arguments

isRec :: Int -> Type -> QName -> Bool

Check if argument n is recursive

argIsDef :: Type -> QName -> Bool