[Haskell-cafe] Pointer to clarifying page "Hask" for beginners who take too naively claims of "rigor" Was: Re: From monads to monoids in a small category

Jay Sulzberger jays at panix.com
Wed Sep 5 22:10:45 CEST 2012

On Tue, 4 Sep 2012, Alexander Solla <alex.solla at gmail.com> wrote:

> On Tue, Sep 4, 2012 at 4:21 PM, Alexander Solla <alex.solla at gmail.com>wrote:
>> On Tue, Sep 4, 2012 at 3:39 AM, Alberto G. Corona <agocorona at 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.)

This is not directly responsive to what has been written in this
thread, but is a beginner's, likely mistaken, complaint:

In many expositions of "monads" and other such Haskelliana, often
there is missing a few words of explanation in this style:

   A monad in category theory is a <here is a pointer or an actual explanation/>.

   To define the monad M in Haskell, we must pick out a category
   embedded in some sense in Haskell.  A category has objects and
   morphisms which must obey certain laws.  So for M we choose <something/>.

Now the <something/> directly above might pick out something
which cannot be easily directly described inside the Haskell
world, or even in the first layers of the onion of
worlds-about-Haskell.  For example we might have:

   The objects of our category are types whose sets of values,
   always taken without _|_, are finite, or if infinite, come with
   a partial ordering which is isomorphic to a subset of N^2, with
   the usual product of N ordering.

Note I have no example in mind here, though certainly one can
make one up.  It is the style I am pointing out.

We then must have a paragraph defining, in a similar style, the
morphisms, the identity morphisms, and the composition of
morphisms of our category, which is "embedded", by means outside
of Haskell, into Haskell.

Then we must have a paragraph defining the monad itself, so we
have our endofunctor T, as Wikipedia calls it in the article on
monads (category theory sense), and the two natural
transformations \eta and \mu.

And then, ah, hmunh, mmh, Oi! again I have failed to look at the
standard introductory literature.  The missing gentle words of
clarification, and thus, encouragement, are at


and the two notes there pointed to.


More information about the Haskell-Cafe mailing list