Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions that manipulate the environment.
Synopsis
- data Value
- withEnv :: Env -> PencilApp a -> PencilApp a
- insert :: Text -> Value -> Env -> Env
- insertText :: Text -> Text -> Env -> Env
- adjust :: (Value -> Value) -> Text -> Env -> Env
- merge :: Env -> Env -> Env
- toText :: Value -> Text
- toTextRss :: Value -> Text
- arrayContainsText :: Text -> Value -> Bool
- dateOrdering :: Value -> Value -> Ordering
- maybeOrdering :: (Value -> Value -> Ordering) -> Maybe Value -> Maybe Value -> Ordering
Documentation
withEnv :: Env -> PencilApp a -> PencilApp a Source #
Runs the computation with the given environment. This is useful when you
want to render a Page
or Structure
with a modified environment.
withEnv (insertText
"newvar" "newval" env) (render
page)
Alternatively, use local
, which is re-exported in the Pencil module.
Inserts Value
into the given Env
.
Inserts text into the given Env
.
env <- asks getEnv insertText "title" "My Awesome Website" env
Modifies a variable in the given environment.
merge :: Env -> Env -> Env Source #
Merges two Env
s together, biased towards the left-hand Env
on duplicates.
toText :: Value -> Text Source #
Renders environment value for human consumption. This is the default one.