Michael Vanier mvanier at cs.caltech.edu
Fri Aug 19 01:47:42 EDT 2005

The explanation given below might be a bit heavy for someone who didn't know much
papers:

I especially recommend "Monads for Functional Programming", "The Essence of

Basically, though, the Haskell implementation _is_ the category theoretic
described below.

Mike

> Date: Thu, 18 Aug 2005 20:39:37 -0400
> From: Cale Gibbard <cgibbard at gmail.com>
>
> On 14/08/05, Carl Marks <id2359 at yahoo.com> wrote:
> > Is there any text/article which makes precise/rigorous/explicit the connection
> > between the category theoretic definition of monad with the haskell
> > implementation?
>
> Well, a monad over a category C is an endofunctor T on C, together
> with a pair of natural transformations eta: 1 -> T, and mu: T^2 -> T
> such that
> 1) mu . (mu . T) = mu . (T . mu)
> 2) mu . (T . eta) = mu . (eta . T) = id_C
>
> types and Haskell functions between them. Application of the
> endofunctor to an object is given by applying a type constructor (the
> one which is made an instance of the Monad class). Application of the
> endofunctor to a function is carried out by fmap or liftM. The natural
> transformation eta is called return, and mu is called join (found in
>
> Haskell uses a somewhat different (but equivalent) basis for a monad,
> in that it is not map, return, and join which need defining to make a
> type an instance of the Monad class, but return and (>>=), called
> "bind" or "extend".
>
> One can define bind in terms of fmap, and join as
> x >>= f = join (fmap f x)
>
> and one can get back join and fmap from return and bind:
> join x = x >>= id
> fmap f x = x >>= (return . f)
>
> hope this helps,
> - Cale
> _______________________________________________