Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell98 |
The Context
datatype places a value in a context consisting of an
environment with bindings and a point of focus. The datatype is an instance
of the HasEnvironment
type class (for accessing the environment) and
the Navigator
type class (for traversing the term).
- data Context a
- newContext :: ContextNavigator a -> Context a
- fromContext :: Monad m => Context a -> m a
- fromContextWith :: Monad m => (a -> b) -> Context a -> m b
- fromContextWith2 :: Monad m => (a -> b -> c) -> Context a -> Context b -> m c
- data ContextNavigator a
- noNavigator :: a -> ContextNavigator a
- navigator :: Uniplate a => a -> ContextNavigator a
- termNavigator :: IsTerm a => a -> ContextNavigator a
- liftToContext :: LiftView f => f a -> f (Context a)
- contextView :: View (Context a) (a, Context a)
- use :: (LiftView f, IsTerm a, IsTerm b) => f a -> f (Context b)
- useC :: (LiftView f, IsTerm a, IsTerm b) => f (Context a) -> f (Context b)
- applyTop :: (a -> a) -> Context a -> Context a
- currentTerm :: Context a -> Maybe Term
- changeTerm :: (Term -> Maybe Term) -> Context a -> Maybe (Context a)
- replaceInContext :: a -> Context a -> Context a
- currentInContext :: Context a -> Maybe a
- changeInContext :: (a -> a) -> Context a -> Context a
Abstract data type
Abstract data type for a context: a context stores an envrionent.
newContext :: ContextNavigator a -> Context a Source #
Construct a context
fromContext :: Monad m => Context a -> m a Source #
fromContextWith :: Monad m => (a -> b) -> Context a -> m b Source #
Context navigator
data ContextNavigator a Source #
noNavigator :: a -> ContextNavigator a Source #
navigator :: Uniplate a => a -> ContextNavigator a Source #
termNavigator :: IsTerm a => a -> ContextNavigator a Source #
Lifting
liftToContext :: LiftView f => f a -> f (Context a) Source #
Lift a rule to operate on a term in a context
applyTop :: (a -> a) -> Context a -> Context a Source #
Apply a function at top-level. Afterwards, try to return the focus to the old position
replaceInContext :: a -> Context a -> Context a Source #
currentInContext :: Context a -> Maybe a Source #
changeInContext :: (a -> a) -> Context a -> Context a Source #