Re: [Haskell-cafe] Swapping Monads

2008-07-08 Thread Derek Elkins
On Tue, 2008-07-08 at 06:39 +0100, Dominic Steinitz wrote:
> I have a solution so this is for interest only.
> 
> It is not normally the case that two monads compose to give another
> monad. Monad transformers capture when this is possible. However, when
> there is a "swap" function satisfying some commutative diagrams then it
> can be proved that the monads compose  to produce a monad.
> 
> Is there such a swap function in a library? I had a look in the
> comprehensive category-extra package but couldn't find anything.

You didn't look hard enough.  What you want is called a distributive law
in category theory.  A class for exactly what you want is in
Control.Functor.Extras.

http://hackage.haskell.org/packages/archive/category-extras/0.53.5/doc/html/Control-Functor-Extras.html#t%3ADistributes

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


re: [Haskell-cafe] Swapping Monads

2008-07-09 Thread Greg Meredith
Dominic,

You can also reference Eugenia Cheng's paper on
arXiv
.

Best wishes,

--greg

-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe