[Haskell-cafe] Haskell-Cafe Digest, Vol 124, Issue 39
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  from traversable. It doesn't have a Monad
> instance, though...
>  http://hackage.haskell.org/package/transformers-0.3.0.0/docs/Data-Functor-Compose.html
According to , 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?
: http://web.cecs.pdx.edu/~mpj/pubs/RR-1004.pdf, page 9
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe