<br><br><div class="gmail_quote">On Tue, Sep 4, 2012 at 4:21 PM, Alexander Solla <span dir="ltr"><<a href="mailto:alex.solla@gmail.com" target="_blank">alex.solla@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><div class="gmail_quote"><div class="im">On Tue, Sep 4, 2012 at 3:39 AM, Alberto G. Corona <span dir="ltr"><<a href="mailto:agocorona@gmail.com" target="_blank">agocorona@gmail.com</a>></span> wrote:<br></div>
<div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
"Monads are monoids in the category of endofunctors"<br>
<br>
This Monoid instance for the endofunctors of the set of all elements<br>
of (m a) typematch in Haskell with FlexibleInstances:<br>
<br>
instance Monad m => Monoid (a -> m a) where<br>
mappend = (>=>) -- kleisly operator<br>
mempty = return<br></blockquote><div><br></div></div><div>The objects of a Kliesli category for a monad m aren't endofunctors. You want something like:</div><div><br></div><div>instance Monad m => Monoid (m a -> m (m a)) where ...</div>
<div><br></div><div>/These/ are endofunctors, in virtue of join transforming an m (m a) into an (m a).</div></div></blockquote><div><br></div><div>Actually, even these aren't endofunctors, for a similar reason that : you "really" want something like</div>
<div><br></div><div>instance Monad m => Monoid (m a -> m a) where</div><div> mempty = id</div><div> mappend = undefined -- exercise left to the reader</div><div><br></div><div>(i.e., you want to do plumbing through the Eilenberg-Moore category for a monad, instead of the Kliesli category for a monad -- my last message exposes the kind of plumping you want, but not the right types.)</div>
</div>