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

Safe Haskell | None
Language | Haskell2010

Agda.TypeChecking.Rules.Def

Contents

- Definitions by pattern matching

Synopsis

- checkFunDef :: Delayed -> DefInfo -> QName -> [Clause] -> TCM ()
- checkMacroType :: Type -> TCM ()
- isAlias :: [Clause] -> Type -> Maybe (Expr, Maybe Expr, MetaId)
- checkAlias :: Type -> ArgInfo -> Delayed -> DefInfo -> QName -> Expr -> Maybe Expr -> TCM ()
- checkFunDef' :: Type -> ArgInfo -> Delayed -> Maybe ExtLamInfo -> Maybe QName -> DefInfo -> QName -> [Clause] -> TCM ()
- checkFunDefS :: Type -> ArgInfo -> Delayed -> Maybe ExtLamInfo -> Maybe QName -> DefInfo -> QName -> Maybe Substitution -> [Clause] -> TCM ()
- useTerPragma :: Definition -> TCM Definition
- insertPatterns :: [Pattern] -> RHS -> RHS
- data WithFunctionProblem
  - = NoWithFunction
  - | WithFunction {
    - wfParentName :: QName
    - wfName :: QName
    - wfParentType :: Type
    - wfBeforeTel :: Telescope
    - wfAfterTel :: Telescope
    - wfExprs :: [Term]
    - wfExprTypes :: [EqualityView]
    - wfRHSType :: Type
    - wfParentPats :: [NamedArg DeBruijnPattern]
    - wfParentParams :: Nat
    - wfPermSplit :: Permutation
    - wfPermParent :: Permutation
    - wfPermFinal :: Permutation
    - wfClauses :: [Clause]
    }
- checkClause :: Type -> Maybe Substitution -> SpineClause -> TCM Clause
- checkRHS :: LHSInfo -> QName -> [NamedArg Pattern] -> Type -> LHSResult -> RHS -> TCM (Maybe Term, WithFunctionProblem)
- checkWithRHS :: QName -> QName -> Type -> LHSResult -> [Term] -> [EqualityView] -> [Clause] -> TCM (Maybe Term, WithFunctionProblem)
- checkWithFunction :: [Name] -> WithFunctionProblem -> TCM ()
- checkWhere :: [Declaration] -> TCM a -> TCM a
- newSection :: ModuleName -> Telescope -> TCM a -> TCM a
- containsAbsurdPattern :: Pattern -> Bool
- atClause :: QName -> Int -> RHS -> TCM a -> TCM a

# Definitions by pattern matching

checkFunDef :: Delayed -> DefInfo -> QName -> [Clause] -> TCM () #

checkMacroType :: Type -> TCM () #

isAlias :: [Clause] -> Type -> Maybe (Expr, Maybe Expr, MetaId) #

A single clause without arguments and without type signature is an alias.

checkAlias :: Type -> ArgInfo -> Delayed -> DefInfo -> QName -> Expr -> Maybe Expr -> TCM () #

Check a trivial definition of the form `f = e`

checkFunDef' #

Arguments

:: Type | the type we expect the function to have
-> ArgInfo | is it irrelevant (for instance)
-> Delayed | are the clauses delayed (not unfolded willy-nilly)
-> Maybe ExtLamInfo | does the definition come from an extended lambda (if so, we need to know some stuff about lambda-lifted args)
-> Maybe QName | is it a with function (if so, what's the name of the parent function)
-> DefInfo | range info
-> QName | the name of the function
-> [Clause] | the clauses to check
-> TCM () |

Type check a definition by pattern matching.

checkFunDefS #

Arguments

:: Type | the type we expect the function to have
-> ArgInfo | is it irrelevant (for instance)
-> Delayed | are the clauses delayed (not unfolded willy-nilly)
-> Maybe ExtLamInfo | does the definition come from an extended lambda (if so, we need to know some stuff about lambda-lifted args)
-> Maybe QName | is it a with function (if so, what's the name of the parent function)
-> DefInfo | range info
-> QName | the name of the function
-> Maybe Substitution | substitution (from with abstraction) that needs to be applied to module parameters
-> [Clause] | the clauses to check
-> TCM () |

Type check a definition by pattern matching.

useTerPragma :: Definition -> TCM Definition #

Set `funTerminates` according to termination info in `TCEnv`, which comes from a possible termination pragma.

insertPatterns :: [Pattern] -> RHS -> RHS #

Insert some patterns in the in with-clauses LHS of the given RHS

data WithFunctionProblem #

Parameters for creating a `with`-function.

Constructors

NoWithFunction |
WithFunction |
Fields wfParentName :: QName Parent function name. wfName :: QName With function name. wfParentType :: Type Type of the parent function. wfBeforeTel :: Telescope Types of arguments to the with function before the with expressions (needed vars). wfAfterTel :: Telescope Types of arguments to the with function after the with expressions (unneeded vars). wfExprs :: [Term] With and rewrite expressions. wfExprTypes :: [EqualityView] Types of the with and rewrite expressions. wfRHSType :: Type Type of the right hand side. wfParentPats :: [NamedArg DeBruijnPattern] Parent patterns. wfParentParams :: Nat Number of module parameters in parent patterns wfPermSplit :: Permutation Permutation resulting from splitting the telescope into needed and unneeded vars. wfPermParent :: Permutation Permutation reordering the variables in the parent pattern. wfPermFinal :: Permutation Final permutation (including permutation for the parent clause). wfClauses :: [Clause] The given clauses for the with function

checkClause #

Arguments

:: Type | Type of function defined by this clause.
-> Maybe Substitution | Module parameter substitution arising from with-abstraction.
-> SpineClause | Clause.
-> TCM Clause | Type-checked clause.

Type check a function clause.

checkRHS #

Arguments

:: LHSInfo | Range of lhs.
-> QName | Name of function.
-> [NamedArg Pattern] | Patterns in lhs.
-> Type | Top-level type of function.
-> LHSResult | Result of type-checking patterns
-> RHS | Rhs to check.
-> TCM (Maybe Term, WithFunctionProblem) |

Type check the `with` and `rewrite` lhss and/or the rhs.

checkWithRHS #

Arguments

:: QName | Name of function.
-> QName | Name of the with-function.
-> Type | Type of function.
-> LHSResult | Result of type-checking patterns
-> [Term] | With-expressions.
-> [EqualityView] | Types of with-expressions.
-> [Clause] | With-clauses to check.
-> TCM (Maybe Term, WithFunctionProblem) |

checkWithFunction :: [Name] -> WithFunctionProblem -> TCM () #

checkWhere #

Arguments

:: [Declaration] | Where-declarations to check.
-> TCM a | Continuation.
-> TCM a |

Type check a where clause.

newSection :: ModuleName -> Telescope -> TCM a -> TCM a #

Enter a new section during type-checking.

containsAbsurdPattern :: Pattern -> Bool #

Check if a pattern contains an absurd pattern. For instance, `suc ()`

atClause :: QName -> Int -> RHS -> TCM a -> TCM a #

Set the current clause number.