HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

ModuleAgda-2.7.0.1Haskell2010

Agda.TypeChecking.Rules.Term

  • 1 type
  • 57 values
  • PackageAgda-2.7.0.1
  • Exports58
  • LanguageHaskell2010
  • LicenceMIT
  • SourceTerm.hs

Types

6 declarations
valueisType' :: Comparison -> Expr -> Sort -> TCM Type
#

Check that an expression is a type. * If c == CmpEq, the given sort must be the minimal sort. * If c == CmpLeq, the given sort may be any bigger sort.

valueisType_ :: Expr -> TCM Type
#

Check that an expression is a type and infer its (minimal) sort.

valueisTypeEqualTo :: Expr -> Type -> TCM Type
#

Ensure that a (freshly created) function type does not inhabit SizeUniv. Precondition: When noFunctionsIntoSize t tBlame is called, we are in the context of tBlame in order to print it correctly. Not being in context of t should not matter, as we are only checking whether its sort reduces to SizeUniv.

Currently UNUSED since SizeUniv is turned off (as of 2016).

Check that an expression is a type which is equal to a given type.

Telescopes

11 declarations
valuecheckPiTelescope :: Telescope -> (Telescope -> TCM a) -> TCM a
#

Type check the telescope of a dependent function type. Binds the resurrected variables defined by the telescope. The returned telescope is unmodified (not resurrected).

datadata LamOrPi
#

Flag to control resurrection on domains.

Constructors

  • LamNotPi

    We are checking a module telescope. We pass into the type world to check the domain type. This resurrects the whole context.

  • PiNotLam

    We are checking a telescope in a Pi-type. We stay in the term world, but add resurrected domains to the context to check the remaining domains and codomain of the Pi-type.

Instances2Eq, Show
  • Eq LamOrPiDefined in Agda-2.7.0.1 · Agda.TypeChecking.Rules.Term
  • Show LamOrPiDefined in Agda-2.7.0.1 · Agda.TypeChecking.Rules.Term

Check a typed binding and extends the context with the bound variables. The telescope passed to the continuation is valid in the original context.

Parametrized by a flag whether we check a typed lambda or a Pi. This flag is needed for irrelevance.

Lambda abstractions

14 declarations
valueinsertHiddenLambdas
  1. :: Hiding

    Expected hiding.

  2. -> Type

    Expected to be a function type.

  3. -> (Blocker -> Type -> TCM Term)

    Continuation on blocked type.

  4. -> (Type -> TCM Term)

    Continuation when expected hiding found. The continuation may assume that the Type is of the form (El _ (Pi _ _)).

  5. -> TCM Term

    Term with hidden lambda inserted.

#

Insert hidden lambda until the hiding info of the domain type matches the expected hiding info. Throws WrongHidingInLambda

Run a computation.

  • If successful, that's it, we are done.

  • If NotADatatype a or CannotEliminateWithPattern p a is thrown and type a is blocked on some meta x, reset any changes to the state and pass (the error and) x to the handler.

  • If SplitError (UnificationStuck c tel us vs _) is thrown and the unification problem us =?= vs : tel is blocked on some meta x pass x to the handler.

  • If another error was thrown or the type a is not blocked, reraise the error.

Note that the returned meta might only exists in the state where the error was thrown, thus, be an invalid MetaId in the current state.

Records

3 declarations
valueexpandModuleAssigns
  1. :: [Either Assign ModuleName]

    Modules and field assignments.

  2. -> [Name]

    Names of fields of the record type.

  3. -> TCM Assigns

    Completed field assignments from modules.

#

Picks up record field assignments from modules that export a definition that has the same name as the missing field.

valuecheckRecordExpression
  1. :: Comparison

    How do we related the inferred type of the record expression to the expected type? Subtype or equal type?

  2. -> RecordAssigns

    mfs: modules and field assignments.

  3. -> Expr

    Must be A.Rec _ mfs.

  4. -> Type

    Expected type of record expression.

  5. -> TCM Term

    Record value in internal syntax.

#

checkRecordExpression fs e t checks record construction against type t. Precondition e = Rec _ fs.

Literal

1 declaration

Terms

3 declarations

Reflection

3 declarations
valueunquoteTactic :: Term -> Term -> Type -> TCM ()
#

Run a tactic `tac : Term → TC ⊤` in a hole (second argument) of the type given by the third argument. Runs the continuation if successful.

Meta variables

15 declarations
valuecheckKnownArguments
  1. :: [NamedArg Expr]

    User-supplied arguments (hidden ones may be missing).

  2. -> Args

    Inferred arguments (including hidden ones).

  3. -> Type

    Type of the head (must be Pi-type with enough domains).

  4. -> TCM (Args, Type)

    Remaining inferred arguments, remaining type.

#

Check arguments whose value we already know.

This function can be used to check user-supplied parameters we have already computed by inference.

Precondition: The type t of the head has enough domains.

valuecheckKnownArgument
  1. :: NamedArg Expr

    User-supplied argument.

  2. -> Args

    Inferred arguments (including hidden ones).

  3. -> Type

    Type of the head (must be Pi-type with enough domains).

  4. -> TCM (Args, Type)

    Remaining inferred arguments, remaining type.

#

Check an argument whose value we already know.

valueinferExpr :: Expr -> TCM (Term, Type)
#

Infer the type of an expression. Implemented by checking against a meta variable. Except for neutrals, for them a polymorphic type is inferred.

valueinferExprForWith :: Arg Expr -> TCM (Term, Type)
#

Infer the type of an expression, and if it is of the form {tel} -> D vs for some datatype D then insert the hidden arguments. Otherwise, leave the type polymorphic.

Let bindings

2 declarations