Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Ginger.Interpret.Type
Synopsis
- newtype GingerT (m :: Type -> Type) a = GingerT {}
- data EvalState (m :: Type -> Type) = EvalState {
- evalEnv :: !(Env m)
- evalMutables :: !(Map RefID (Value m))
- evalNextRefID :: !RefID
- evalLoadedTemplates :: !(Map Text CachedTemplate)
- evalBlocks :: !(Map Identifier LoadedBlock)
- evalSourcePosition :: !(Maybe SourcePosition)
- data LoadedBlock = LoadedBlock {
- loadedBlock :: !Block
- loadedBlockParent :: !(Maybe LoadedBlock)
- data CachedTemplate
- data LoadedTemplate = LoadedTemplate {}
- runGingerT :: MonadRandom m => GingerT m a -> Context m -> Env m -> m (Either RuntimeError a)
- decorateError :: forall (m :: Type -> Type) a. Monad m => SourcePosition -> RuntimeError -> GingerT m a
- lookupVar :: forall (m :: Type -> Type). Monad m => Identifier -> GingerT m (Value m)
- lookupVarMaybe :: forall (m :: Type -> Type). Monad m => Identifier -> GingerT m (Maybe (Value m))
- modifyEnv :: forall (m :: Type -> Type). Monad m => (Env m -> Env m) -> GingerT m ()
- setVar :: forall (m :: Type -> Type). Monad m => Identifier -> Value m -> GingerT m ()
- setVars :: forall (m :: Type -> Type). Monad m => Map Identifier (Value m) -> GingerT m ()
- setMutable :: forall (m :: Type -> Type). Monad m => Identifier -> Identifier -> Value m -> GingerT m ()
- setBlock :: forall (m :: Type -> Type). Monad m => Identifier -> Block -> GingerT m LoadedBlock
- allocMutable :: forall (m :: Type -> Type) t. (Monad m, MonadTrans t, MonadState (EvalState m) (t m)) => Value m -> t m RefID
- assignMutable :: forall (m :: Type -> Type). Monad m => RefID -> Value m -> GingerT m ()
- modifyMutable :: forall (m :: Type -> Type). Monad m => RefID -> (Value m -> GingerT m (Value m)) -> GingerT m ()
- derefMutableMaybe :: forall (m :: Type -> Type). Monad m => RefID -> GingerT m (Maybe (Value m))
- derefMutable :: forall (m :: Type -> Type). Monad m => RefID -> GingerT m (Value m)
- setSourcePosition :: forall (m :: Type -> Type). Monad m => SourcePosition -> GingerT m ()
- clearSourcePosition :: forall (m :: Type -> Type). Monad m => GingerT m ()
- appendLoadedBlock :: LoadedBlock -> LoadedBlock -> LoadedBlock
- getBlock :: forall (m :: Type -> Type). Monad m => Identifier -> GingerT m (Maybe LoadedBlock)
- scoped :: forall (m :: Type -> Type) a. Monad m => GingerT m a -> GingerT m a
- withoutContext :: forall (m :: Type -> Type) a. Monad m => GingerT m a -> GingerT m a
- withEnv :: forall (m :: Type -> Type) a. Monad m => Env m -> GingerT m a -> GingerT m a
- bind :: forall (m :: Type -> Type) a. Monad m => (Env m -> a) -> GingerT m a
- scopify :: forall (m :: Type -> Type). Monad m => Value m -> GingerT m ()
- withJinjaFilters :: forall (m :: Type -> Type) a. Monad m => GingerT m a -> GingerT m a
- withJinjaTests :: forall (m :: Type -> Type) a. Monad m => GingerT m a -> GingerT m a
- withJinjaKey :: forall (m :: Type -> Type) a. Monad m => Identifier -> GingerT m a -> GingerT m a
Documentation
newtype GingerT (m :: Type -> Type) a Source #
The Ginger interpreter monad. Provides error reporting / handling via
MonadError
, an execution context (Context
), and an evaluation state
(EvalState
).
Constructors
GingerT | |
Instances
MonadTrans GingerT Source # | |
Defined in Language.Ginger.Interpret.Type | |
Monad m => MonadError RuntimeError (GingerT m) Source # | |
Defined in Language.Ginger.Interpret.Type Methods throwError :: RuntimeError -> GingerT m a # catchError :: GingerT m a -> (RuntimeError -> GingerT m a) -> GingerT m a # | |
Monad m => Applicative (GingerT m) Source # | |
Defined in Language.Ginger.Interpret.Type | |
Functor m => Functor (GingerT m) Source # | |
Monad m => Monad (GingerT m) Source # | |
Monad m => MonadReader (Context m) (GingerT m) Source # | |
Monad m => MonadState (EvalState m) (GingerT m) Source # | |
data EvalState (m :: Type -> Type) Source #
Evaluation state. This keeps track of variables in scope, as well as loaded templates and blocks, and the current source position.
Constructors
EvalState | |
Fields
|
data LoadedBlock Source #
Constructors
LoadedBlock | |
Fields
|
Instances
Show LoadedBlock Source # | |
Defined in Language.Ginger.Interpret.Type Methods showsPrec :: Int -> LoadedBlock -> ShowS # show :: LoadedBlock -> String # showList :: [LoadedBlock] -> ShowS # |
data CachedTemplate Source #
Constructors
CachedTemplate !LoadedTemplate | |
MissingTemplate |
data LoadedTemplate Source #
Constructors
LoadedTemplate | |
Fields |
runGingerT :: MonadRandom m => GingerT m a -> Context m -> Env m -> m (Either RuntimeError a) Source #
decorateError :: forall (m :: Type -> Type) a. Monad m => SourcePosition -> RuntimeError -> GingerT m a Source #
lookupVarMaybe :: forall (m :: Type -> Type). Monad m => Identifier -> GingerT m (Maybe (Value m)) Source #
setMutable :: forall (m :: Type -> Type). Monad m => Identifier -> Identifier -> Value m -> GingerT m () Source #
setBlock :: forall (m :: Type -> Type). Monad m => Identifier -> Block -> GingerT m LoadedBlock Source #
allocMutable :: forall (m :: Type -> Type) t. (Monad m, MonadTrans t, MonadState (EvalState m) (t m)) => Value m -> t m RefID Source #
modifyMutable :: forall (m :: Type -> Type). Monad m => RefID -> (Value m -> GingerT m (Value m)) -> GingerT m () Source #
derefMutableMaybe :: forall (m :: Type -> Type). Monad m => RefID -> GingerT m (Maybe (Value m)) Source #
setSourcePosition :: forall (m :: Type -> Type). Monad m => SourcePosition -> GingerT m () Source #
getBlock :: forall (m :: Type -> Type). Monad m => Identifier -> GingerT m (Maybe LoadedBlock) Source #
withoutContext :: forall (m :: Type -> Type) a. Monad m => GingerT m a -> GingerT m a Source #
Run a GingerT
action in a fresh environment; however, any globals set
by the invoked action will be ported back to the calling environment.
scopify :: forall (m :: Type -> Type). Monad m => Value m -> GingerT m () Source #
Lift a dictionary value into the current scope, such that dictionary keys become variables bound to the respective values in the dictionary.
withJinjaKey :: forall (m :: Type -> Type) a. Monad m => Identifier -> GingerT m a -> GingerT m a Source #