[Snap Framework] Splice functions and a custom monad
kevinjardine at yahoo.com
Tue Jun 15 01:12:09 CDT 2010
Yes, thanks. I do need lift to access MyMonad though. I understand that there is something called a passthrough that might remove this requirement. Do you know how that works?
--- On Tue, 6/15/10, MightyByte <mightybyte at gmail.com> wrote:
> From: MightyByte <mightybyte at gmail.com>
> Subject: Re: [Snap Framework] Splice functions and a custom monad
> To: "Kevin Jardine" <kevinjardine at yahoo.com>
> Cc: snap at snapframework.com
> Date: Tuesday, June 15, 2010, 3:21 AM
> You mentioned two different error messages above. I
> just wanted to
> verify that both of them are taken care of now?
> On Mon, Jun 14, 2010 at 6:19 PM, Kevin Jardine <kevinjardine at yahoo.com>
> > 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 <kevinjardine at yahoo.com>
> >> From: Kevin Jardine <kevinjardine at yahoo.com>
> >> Subject: [Snap Framework] Splice functions and a
> custom monad
> >> To: snap at snapframework.com
> >> 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
> >> 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
> >> Snap at snapframework.com
> >> http://mailman-mail5.webfaction.com/listinfo/snap
> > _______________________________________________
> > Snap mailing list
> > Snap at snapframework.com
> > http://mailman-mail5.webfaction.com/listinfo/snap
More information about the Snap