[Haskell-cafe] From monads to monoids in a small category
Alberto G. Corona
agocorona at gmail.com
Wed Sep 5 18:47:17 CEST 2012
In my post (excuses for my dyslexia) I try to demonstrate that the
codomain (m a), from the point of view of C. Theory, can be seen as
'a' plus, optionally, some additional element, so a monadic morphism
(a -> m a) is part of a endofunctor in (m a -> m a)
When considering the concept of arrow from category theory, (not the
concept of function), a point in the domain can "send" more than one
arrow to the codomain, while a function do not. I think that this is
the most interesting part of the interpretation, if I´m right.
About this, I found this article revealing:
Therefore, codomains of (a -> m a) which are containers with multiple
a elements can be considered as multi-arrow morphisms from 'a' to 'a'
with the optional addition of some special elements that denote
(a -> [a])
May be considered as the general signature of the morphisms from the
set 'a' to the set ('a' + )
So a monadic transformation (a -> [a]) can be considered as a point
transformation of a endofunctor within the set (a + ).
2012/9/5 Alexander Solla <alex.solla at gmail.com>:
> On Tue, Sep 4, 2012 at 4:21 PM, Alexander Solla <alex.solla at gmail.com>
>> On Tue, Sep 4, 2012 at 3:39 AM, Alberto G. Corona <agocorona at gmail.com>
>>> "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.)
More information about the Haskell-Cafe