[Haskell-cafe] M1 + M2 = M3 where both computations in M1 and M2 can be used?

Kenn Knowles kenn at kenn.frap.net
Mon May 12 14:33:20 EDT 2008


On Mon, May 12, 2008 at 6:51 AM, sam lee <skynare at gmail.com> wrote:
> Hi.
>
>  I want to compose two monads to build another monad where
>  computations of the two monads can be used inside.

Twan's suggestion seems like a natural way to continue with the
existing code you have described (based on monad transformers).  If
you would like to understand this issue in some depth, I recommend the
following paper which presents a general way to combine two monads
that is not biased towards having one "contained" in the other.

 - Composing monads using coproducts. C L=FCth, N Ghani. ICFP 2002.
 - http://www.mcs.le.ac.uk/~ng13/papers/icfp02.ps.gz

I just tried it out the other day, so if you'll excuse the
self-promotion here is a demonstration

http://www.kennknowles.com/blog/2008/05/10/debugging-with-open-recursion-mixins/

- Kenn


More information about the Haskell-Cafe mailing list