I wish to add some hooks for pre-processing Heist templates in a web application using Snap. My naïve approach so far has been to use the following code in my application initializer:
app :: SnapletInit App App
app = makeSnaplet "app" "The main web application" Nothing $ do
-- ...
h <- nestSnaplet "heist" heist $ heistInit "resources/templates"
-- ...
modifyHeistTS . addOnLoadHook $ myTemplateHook
This code does of course not work, since the hook is added after the templates are loaded from "resources/templates"
How would one go about modifying the Heist template state before the initial templates are loaded, in order to add OnLoad hooks?