Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- modifyContext :: MonadTCM tcm => (Context -> Context) -> tcm a -> tcm a
- safeInTopContext :: MonadTCM tcm => tcm a -> tcm a
- inTopContext :: MonadTCM tcm => tcm a -> tcm a
- escapeContext :: MonadTCM tcm => Int -> tcm a -> tcm a
- checkpoint :: (MonadDebug tcm, MonadTCM tcm) => Substitution -> tcm a -> tcm a
- updateContext :: (MonadDebug tcm, MonadTCM tcm) => Substitution -> (Context -> Context) -> tcm a -> tcm a
- checkpointSubstitution :: MonadReader TCEnv tcm => CheckpointId -> tcm Substitution
- getModuleParameterSub :: (MonadReader TCEnv m, ReadTCState m) => ModuleName -> m Substitution
- addCtx :: (MonadDebug tcm, MonadTCM tcm) => Name -> Dom Type -> tcm a -> tcm a
- unshadowedName :: [Name] -> Name -> Name
- unshadowName :: MonadTCM tcm => Name -> tcm Name
- class AddContext b where
- newtype KeepNames a = KeepNames a
- dummyDom :: Dom Type
- underAbstraction :: (Subst t a, MonadTCM tcm, MonadDebug tcm) => Dom Type -> Abs a -> (a -> tcm b) -> tcm b
- underAbstraction' :: (Subst t a, MonadTCM tcm, MonadDebug tcm, AddContext (name, Dom Type)) => (String -> name) -> Dom Type -> Abs a -> (a -> tcm b) -> tcm b
- underAbstraction_ :: (Subst t a, MonadTCM tcm, MonadDebug tcm) => Abs a -> (a -> tcm b) -> tcm b
- addLetBinding :: MonadTCM tcm => ArgInfo -> Name -> Term -> Type -> tcm a -> tcm a
- getContext :: MonadReader TCEnv m => m [Dom (Name, Type)]
- getContextSize :: (Applicative m, MonadReader TCEnv m) => m Nat
- getContextArgs :: (Applicative m, MonadReader TCEnv m) => m Args
- getContextTerms :: (Applicative m, MonadReader TCEnv m) => m [Term]
- getContextTelescope :: (Applicative m, MonadReader TCEnv m) => m Telescope
- getContextNames :: (Applicative m, MonadReader TCEnv m) => m [Name]
- lookupBV :: MonadReader TCEnv m => Nat -> m (Dom (Name, Type))
- typeOfBV' :: (Applicative m, MonadReader TCEnv m) => Nat -> m (Dom Type)
- typeOfBV :: (Applicative m, MonadReader TCEnv m) => Nat -> m Type
- nameOfBV :: (Applicative m, MonadReader TCEnv m) => Nat -> m Name
- getVarInfo :: MonadReader TCEnv m => Name -> m (Term, Dom Type)
Modifying the context
modifyContext :: MonadTCM tcm => (Context -> Context) -> tcm a -> tcm a Source #
Modify a Context
in a computation.
safeInTopContext :: MonadTCM tcm => tcm a -> tcm a Source #
Change to top (=empty) context. Resets the checkpoints.
inTopContext :: MonadTCM tcm => tcm a -> tcm a Source #
Change to top (=empty) context, but don't update the checkpoints. Totally not safe!
escapeContext :: MonadTCM tcm => Int -> tcm a -> tcm a Source #
Delete the last n
bindings from the context.
Doesn't update checkpoints!! Use `updateContext rho (drop n)` instead,
for an appropriate substitution rho
.
Manipulating checkpoints --
checkpoint :: (MonadDebug tcm, MonadTCM tcm) => Substitution -> tcm a -> tcm a Source #
Add a new checkpoint. Do not use directly!
updateContext :: (MonadDebug tcm, MonadTCM tcm) => Substitution -> (Context -> Context) -> tcm a -> tcm a Source #
Update the context. Requires a substitution from the old context to the new.
checkpointSubstitution :: MonadReader TCEnv tcm => CheckpointId -> tcm Substitution Source #
Get the substitution from the context at a given checkpoint to the current context.
getModuleParameterSub :: (MonadReader TCEnv m, ReadTCState m) => ModuleName -> m Substitution Source #
Get substitution Γ ⊢ ρ : Γm
where Γ
is the current context
and Γm
is the module parameter telescope of module m
.
In case the we don't have a checkpoint for m
we return the identity
substitution.
This is ok for instance if we are outside module m
(in which case we
have to supply all module parameters to any symbol defined within m
we
want to refer).
Adding to the context
addCtx :: (MonadDebug tcm, MonadTCM tcm) => Name -> Dom Type -> tcm a -> tcm a Source #
addCtx x arg cont
add a variable to the context.
Chooses an unused Name
.
Warning: Does not update module parameter substitution!
unshadowedName :: [Name] -> Name -> Name Source #
Pick a concrete name that doesn't shadow anything in the given list.
unshadowName :: MonadTCM tcm => Name -> tcm Name Source #
Pick a concrete name that doesn't shadow anything in the context.
class AddContext b where Source #
Various specializations of addCtx
.
addContext :: (MonadTCM tcm, MonadDebug tcm) => b -> tcm a -> tcm a Source #
contextSize :: b -> Nat Source #
Instances
Wrapper to tell 'addContext not to unshadowName
s. Used when adding a
user-provided, but already type checked, telescope to the context.
Instances
AddContext (KeepNames Telescope) Source # | |
Defined in Agda.TypeChecking.Monad.Context addContext :: (MonadTCM tcm, MonadDebug tcm) => KeepNames Telescope -> tcm a -> tcm a Source # | |
AddContext (KeepNames String, Dom Type) Source # | |
Defined in Agda.TypeChecking.Monad.Context |
underAbstraction :: (Subst t a, MonadTCM tcm, MonadDebug tcm) => Dom Type -> Abs a -> (a -> tcm b) -> tcm b Source #
Go under an abstraction.
underAbstraction' :: (Subst t a, MonadTCM tcm, MonadDebug tcm, AddContext (name, Dom Type)) => (String -> name) -> Dom Type -> Abs a -> (a -> tcm b) -> tcm b Source #
underAbstraction_ :: (Subst t a, MonadTCM tcm, MonadDebug tcm) => Abs a -> (a -> tcm b) -> tcm b Source #
Go under an abstract without worrying about the type to add to the context.
addLetBinding :: MonadTCM tcm => ArgInfo -> Name -> Term -> Type -> tcm a -> tcm a Source #
Add a let bound variable.
Querying the context
getContext :: MonadReader TCEnv m => m [Dom (Name, Type)] Source #
Get the current context.
getContextSize :: (Applicative m, MonadReader TCEnv m) => m Nat Source #
Get the size of the current context.
getContextArgs :: (Applicative m, MonadReader TCEnv m) => m Args Source #
Generate [var (n - 1), ..., var 0]
for all declarations in the context.
getContextTerms :: (Applicative m, MonadReader TCEnv m) => m [Term] Source #
Generate [var (n - 1), ..., var 0]
for all declarations in the context.
getContextTelescope :: (Applicative m, MonadReader TCEnv m) => m Telescope Source #
Get the current context as a Telescope
.
getContextNames :: (Applicative m, MonadReader TCEnv m) => m [Name] Source #
Get the names of all declarations in the context.
lookupBV :: MonadReader TCEnv m => Nat -> m (Dom (Name, Type)) Source #
get type of bound variable (i.e. deBruijn index)
typeOfBV' :: (Applicative m, MonadReader TCEnv m) => Nat -> m (Dom Type) Source #
typeOfBV :: (Applicative m, MonadReader TCEnv m) => Nat -> m Type Source #
nameOfBV :: (Applicative m, MonadReader TCEnv m) => Nat -> m Name Source #
getVarInfo :: MonadReader TCEnv m => Name -> m (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.