[Haskell-cafe] primitive operations in StateT
Clark Gaebel
cgaebel at uwaterloo.ca
Tue Apr 16 07:56:02 CEST 2013
The monad my code is currently written in is:
type MC = MCT Identity -- where MCT is the monad transformer version of it.
I have two options for threading state through this:
MCT (ST s) a
StateT s MC a
The first option would work if I had some function with the signature
MCT Identity a -> MCT (ST s) a
but I know of no such function, and the second one would work if I had some
way of making StateT a member of PrimMonad.
Can I see an example with 'lift'?
- Clark
On Tuesday, April 16, 2013, Ivan Lazar Miljenovic wrote:
> On 16 April 2013 15:04, Clark Gaebel <cgaebel at uwaterloo.ca <javascript:;>>
> wrote:
> > Hi list!
> >
> > I want to use MVectors in a StateT monad transformer.
> >
> > How do I do that? StateT isn't a member of 'PrimMonad', and I have no
> idea
> > how to make it one.
>
> You can use Control.Monad.Trans.lift to lift the PrimMonad operations
> to PrimMonad m => StateT s m
>
> >
> > Regards,
> > - Clark
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org <javascript:;>
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
>
>
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com <javascript:;>
> http://IvanMiljenovic.wordpress.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130416/9f945d1a/attachment.htm>
More information about the Haskell-Cafe
mailing list