Composing Monads using Coproducts
started 5/14/2004; 6:39:06 AM  last post 5/14/2004; 4:54:53 PM


Frank Atanassow  Composing Monads using Coproducts
5/14/2004; 6:39:06 AM (reads: 598, responses: 1)


Composing Monads using Coproducts
Christoph Lüth and Neil Ghani
ICFP '02.
We present a new approach to [the problem of composing monads] which is general in that nearly all monads compose, mathematically elegant in using the standard categorical tools underpinning monads and computationally expressive in supporting a canonical recursion operator. In a nutshell, we propose that two monads should be composed by taking their coproduct. Although abstractly this is a simple idea, the actual construction of the coproduct of two monads is nontrivial. We outline this construction, show how to implement the coproduct within Haskell and demonstrate its usage with a few examples. We also discuss its relationship with other ways of combining monads, in particular distributive laws for monads and monad transformers.
I haven't finished it yet, but this looks like an exceptional paper that provides a definitive answer to the vexing problem of how to combine computational effects. It's a great example of how mathematical semantics can inform programming techniques and language design.


Mark Evans  Re: Composing Monads using Coproducts
5/14/2004; 4:54:53 PM (reads: 267, responses: 0)


To coin a phrase, "Use the homepage!" Nice find, Frank.



