[Haskell-cafe] Haskell-Cafe Digest, Vol 124, Issue 39

Hans Höglund hans at hanshoglund.se
Sun Dec 29 17:40:09 UTC 2013

> On Sat, Dec 28, 2013 at 5:13 PM, Tom Ellis
> <tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
> > data Wrap m n a = Wrap (m (n a))
> This is Compose [0] from traversable. It doesn't have a Monad
> instance, though...
> Erik
> [0] http://hackage.haskell.org/package/transformers-
According to [1], Wrap/Compose does indeed have a Monad instance terms of traverse (here called 'swap'). As far as I understand the paper includes a proof that all the Monad laws holds for such as composition, however there is no mention of transformers as the paper predates them. Personally I am not sure that the transformer composition is useful.

Would it be as simple as adding this instance to Data.Functor.Compose:

> instance (Functor m, Traversable n, Monad m, Monad n) => Monad (Compose m n)

or can anyone spot a problem with this approach?


[1]: http://web.cecs.pdx.edu/~mpj/pubs/RR-1004.pdf, page 9
[2]: http://strictlypositive.org/IdiomLite.pdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131229/eabbb644/attachment.html>

More information about the Haskell-Cafe mailing list