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

Safe HaskellNone
LanguageHaskell98

Agda.TypeChecking.Monad.Context

Contents

Synopsis

Modifying the context

modifyContext :: MonadTCM tcm => (Context -> Context) -> tcm a -> tcm a Source

Modify a Context in a computation.

inContext :: MonadTCM tcm => [Dom (Name, Type)] -> tcm a -> tcm a Source

Change the context.

inTopContext :: MonadTCM tcm => tcm a -> tcm a Source

Change to top (=empty) context.

escapeContext :: MonadTCM tcm => Int -> tcm a -> tcm a Source

Delete the last n bindings from the context.

Adding to the context

addCtx :: MonadTCM tcm => Name -> Dom Type -> tcm a -> tcm a Source

addCtx x arg cont add a variable to the context.

Chooses an unused Name.

addCtxs :: MonadTCM tcm => [Name] -> Dom Type -> tcm a -> tcm a Source

add a bunch of variables with the same type to the context

addCtxString :: MonadTCM tcm => String -> Dom Type -> tcm a -> tcm a Source

Turns the string into a name and adds it to the context.

addCtxString_ :: MonadTCM tcm => String -> tcm a -> tcm a Source

Turns the string into a name and adds it to the context, with dummy type.

addCtxStrings_ :: MonadTCM tcm => [String] -> tcm a -> tcm a Source

dummyDom :: Dom Type Source

Context entries without a type have this dummy type.

underAbstraction :: (Subst a, MonadTCM tcm) => Dom Type -> Abs a -> (a -> tcm b) -> tcm b Source

Go under an abstraction.

underAbstraction_ :: (Subst a, MonadTCM tcm) => Abs a -> (a -> tcm b) -> tcm b Source

Go under an abstract without worrying about the type to add to the context.

addCtxTel :: MonadTCM tcm => Telescope -> tcm a -> tcm a Source

Add a telescope to the context.

addLetBinding :: MonadTCM tcm => ArgInfo -> Name -> Term -> Type -> tcm a -> tcm a Source

Add a let bound variable

Querying the context

getContext :: MonadTCM tcm => tcm [Dom (Name, Type)] Source

Get the current context.

getContextSize :: MonadTCM tcm => tcm Nat Source

Get the size of the current context.

getContextArgs :: MonadTCM tcm => tcm Args Source

Generate [var (n - 1), ..., var 0] for all declarations in the context.

getContextTerms :: MonadTCM tcm => tcm [Term] Source

Generate [var (n - 1), ..., var 0] for all declarations in the context.

getContextTelescope :: MonadTCM tcm => tcm Telescope Source

Get the current context as a Telescope.

getContextId :: MonadTCM tcm => tcm [CtxId] Source

Check if we are in a compatible context, i.e. an extension of the given context.

lookupBV :: MonadTCM tcm => Nat -> tcm (Dom (Name, Type)) Source

get type of bound variable (i.e. deBruijn index)

typeOfBV' :: MonadTCM tcm => Nat -> tcm (Dom Type) Source

typeOfBV :: MonadTCM tcm => Nat -> tcm Type Source

nameOfBV :: MonadTCM tcm => Nat -> tcm Name Source

getVarInfo :: MonadTCM tcm => Name -> tcm (Term, Dom Type) Source

Get the term corresponding to a named variable. If it is a lambda bound variable the deBruijn index is returned and if it is a let bound variable its definition is returned.