[Haskell-cafe] Heist template splice functions and custom monad

Gregory Collins greg at gregorycollins.net
Mon Jun 14 16:36:03 EDT 2010

Kevin Jardine <kevinjardine at yahoo.com> writes:

> 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

TemplateMonad does have a MonadTrans instance:


Make sure you're using the "transformers"/"monads-fd" libraries and not

Gregory Collins <greg at gregorycollins.net>

More information about the Haskell-Cafe mailing list