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

Safe Haskell | None
Language | Haskell2010

Agda.TypeChecking.Rules.Data

Contents

- Datatypes

Synopsis

- checkDataDef :: DefInfo -> QName -> [LamBinding] -> [Constructor] -> TCM ()
- forceSort :: Type -> TCM Sort
- smallParams :: Telescope -> Sort -> TCM [Int]
- checkConstructor :: QName -> Telescope -> Nat -> Sort -> Constructor -> TCM [Int]
- bindParameters :: [LamBinding] -> Type -> (Telescope -> Type -> TCM a) -> TCM a
- fitsIn :: Type -> Sort -> TCM ()
- constructs :: Int -> Type -> QName -> TCM [Int]
- isCoinductive :: Type -> TCM (Maybe Bool)

# Datatypes

checkDataDef :: DefInfo -> QName -> [LamBinding] -> [Constructor] -> TCM () #

Type check a datatype definition. Assumes that the type has already been checked.

forceSort :: Type -> TCM Sort #

Ensure that the type is a sort. If it is not directly a sort, compare it to a `newSortMetaBelowInf`.

smallParams :: Telescope -> Sort -> TCM [Int] #

A parameter is small if its sort fits into the data sort. `smallParams` overapproximates the small parameters (in doubt: small).

checkConstructor #

Arguments

:: QName | Name of data type.
-> Telescope | Parameter telescope.
-> Nat | Number of indices of the data type.
-> Sort | Sort of the data type.
-> Constructor | Constructor declaration (type signature).
-> TCM [Int] | Non-linear parameters.

Type check a constructor declaration. Checks that the constructor targets the datatype and that it fits inside the declared sort. Returns the non-linear parameters.

bindParameters :: [LamBinding] -> Type -> (Telescope -> Type -> TCM a) -> TCM a #

Bind the parameters of a datatype.

fitsIn :: Type -> Sort -> TCM () #

Check that the arguments to a constructor fits inside the sort of the datatype. The first argument is the type of the constructor.

constructs :: Int -> Type -> QName -> TCM [Int] #

Return the parameters that share variables with the indices nonLinearParameters :: Int -> Type -> TCM [Int] nonLinearParameters nPars t =

Check that a type constructs something of the given datatype. The first argument is the number of parameters to the datatype.

As a side effect, return the parameters that occur free in indices. E.g. in `data Eq (A : Set)(a : A) : A -> Set where refl : Eq A a a` this would include parameter `a`, but not `A`.

TODO: what if there's a meta here?

isCoinductive :: Type -> TCM (Maybe Bool) #

Is the type coinductive? Returns `Nothing` if the answer cannot be determined.