Snap.Extension.Heist exports the
MonadHeist interface which allows you to
integrate Heist templates into your Snap application. The interface's
a convenience, we also provide
renderWithSplices that combines
render into a single function call.
Snap.Extension.Heist.Impl contains the only implementation of this interface
and can be used to turn your application's monad into a
MonadHeist is unusual among Snap extensions in that it's a multi-parameter
typeclass. The last parameter is your application's monad, and the first is
the monad you want the
TemplateState to use. This is usually, but not
always, also your application's monad.
This module should not be used directly. Instead, import Snap.Extension.Heist.Impl in your application.
- class (Monad n, MonadSnap m) => MonadHeist n m | m -> n where
- renderWithSplices :: MonadHeist n m => ByteString -> [(Text, Splice n)] -> m ()
Renders a template as text/html. If the given template is not found,
Renders a template as the given content type. If the given template
is not found, this returns
Runs an action with a modified
TemplateState. You might want to use
this if you had a set of splices which were customised for a specific
action. To do that you would do:
heistLocal (bindSplices mySplices) $ render "myTemplate"
fileServeSingle. If the given template is not found,
this throws an error.