Heist template splice functions and custom monad

I'd like to run Heist template splice functions in my own custom monad. I can define a splice function as: mySplice :: Splice MyMonad However, when I try to call functions that return values in my monad in mySplice, I get a compile error: Couldn't match expected type TemplateMonad MyMonad a against inferred type MyMonad () I've seen an example in the Heist documentation where the inner MyMonad is accessed using lift. But when I try that, I get another compile error: No instance for (Monad Trans TemplateMonad) arising from the use of 'lift' What do I do to get this to work? Kevin

Kevin Jardine
I'd like to run Heist template splice functions in my own custom monad.
I can define a splice function as:
mySplice :: Splice MyMonad
However, when I try to call functions that return values in my monad in mySplice, I get a compile error:
Couldn't match expected type TemplateMonad MyMonad a against inferred type MyMonad ()
I've seen an example in the Heist documentation where the inner MyMonad is accessed using lift. But when I try that, I get another compile error:
No instance for (Monad Trans TemplateMonad) arising from the use of 'lift'
What do I do to get this to work?
You should post this to the Snap framework mailing list -- join here:
http://mailman-mail5.webfaction.com/listinfo/snap. Please follow up
there.
TemplateMonad does have a MonadTrans instance:
http://hackage.haskell.org/packages/archive/heist/0.2.0/doc/html/Text-Templa...
Make sure you're using the "transformers"/"monads-fd" libraries and not
"mtl".
G
--
Gregory Collins
participants (2)
-
Gregory Collins
-
Kevin Jardine