As MonadIO was no longer being automatically derived without mtl, I added these 
lines:

instance MonadIO MyMonad where
    liftIO m = MyM (liftIO m)

and this seems to have fixed the problem. I no longer need mtl and I can use 
Heist as needed!

--- On Mon, 6/14/10, Kevin Jardine <[email protected]> wrote:

> From: Kevin Jardine <[email protected]>
> Subject: [Snap Framework] Splice functions and a custom monad
> To: [email protected]
> Date: Monday, June 14, 2010, 10:52 PM
> I'd like to run Heist template splice
> functions in my own custom monad (not Snap).
> 
> 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 (MonadTrans TemplateMonad)
> arising from the use of 'lift'
> 
> Gregory Collins advised replacing mtl with monads-fd and
> transformers.
> 
> However, this breaks my custom monad (eg. MonadIO is no
> longer automatically derived).
> 
> How do I get this to work?
> 
> Kevin
> 
> 
>       
> _______________________________________________
> Snap mailing list
> [email protected]
> http://mailman-mail5.webfaction.com/listinfo/snap
> 


      
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to