On Tue, Sep 4, 2012 at 4:21 PM, Alexander Solla <alex.so...@gmail.com>wrote:
> > > On Tue, Sep 4, 2012 at 3:39 AM, Alberto G. Corona <agocor...@gmail.com>wrote: > >> "Monads are monoids in the category of endofunctors" >> >> This Monoid instance for the endofunctors of the set of all elements >> of (m a) typematch in Haskell with FlexibleInstances: >> >> instance Monad m => Monoid (a -> m a) where >> mappend = (>=>) -- kleisly operator >> mempty = return >> > > The objects of a Kliesli category for a monad m aren't endofunctors. You > want something like: > > instance Monad m => Monoid (m a -> m (m a)) where ... > > /These/ are endofunctors, in virtue of join transforming an m (m a) into > an (m a). > Actually, even these aren't endofunctors, for a similar reason that : you "really" want something like instance Monad m => Monoid (m a -> m a) where mempty = id mappend = undefined -- exercise left to the reader (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.)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe