HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

ModuleAgda-2.8.0.2Haskell2010

Agda.TypeChecking.Names

EDSL to construct terms without touching De Bruijn indices.

e.g. given t, u :: Term, Γ ⊢ t, u : A, we can build "λ f. f t u" like this:

runNames [] $ do -- open binds t and u to computations that know how to weaken themselves in -- an extended context

t,u

<- mapM open [t,u]

  • - lam gives the illusion of HOAS by providing f as a computation.

  • - It also extends the internal context with the name "f", so that

  • - t and u will get weakened in the body.

  • - We apply f with the (@) combinator from Agda.TypeChecking.Primitive.

lam "f" $ f -> f @ t @ u

  • 7 types
  • 25 values
  • PackageAgda-2.8.0.2
  • Exports32
  • LanguageHaskell2010
  • LicenceMIT
  • SourceNames.hs
newtypenewtype NamesT (m :: Type -> Type) a
#

Constructors

Instances18MonadTrans, MonadError, MonadState, Monad, Functor, Applicative, …
typetype Names = [String]
#

A list of variable names from a context.

valuecxtSubst :: Monad m => Names -> NamesT m (Substitution' a)
#

cxtSubst Γ returns the substitution needed to go from Γ to the current context.

Precondition Γ is not a subcontext of the current one.

valueinCxt :: (Monad m, Subst a) => Names -> a -> NamesT m a
#

inCxt Γ t takes a t in context Γ and produce an action that will return t weakened to the current context.

Fails whenever cxtSubst Γ would.

typetype Var (m :: Type -> Type) = forall b. (Subst b, DeBruijn b) => NamesT m b
#

Monadic actions standing for variables.

b is quantified over so the same variable can be used e.g. both as a pattern and as an expression.

Helpers to build lambda abstractions.

3 declarations

Combinators for n-ary binders.

16 declarations