[Haskell-cafe] Another monad question...

Miguel Mitrofanov miguelimo38 at yandex.ru
Sun Jul 15 03:25:26 EDT 2007


SOR> I've heard that Monads are in some way like Monoids, hence the
SOR> name. But I don't understand the explanation yet myself :(

Just compare:

Monoid: a set M with maps ident: M^0 -> M and product: M^2 -> M

(here M^0 is a one-element set)

Monad: a functor M with natural transformations return: M^0 -> M and
       join: M^2 -> M

(here M^0 is an identity functor)

If you extend the definition of monoid to arbitrary "monoidal
category", which means, arbitrary category with identity object I and
bifunctor "\times", such that I \times X ~ X \times I ~ X and (X
\times Y) \times Z ~ X \times (Y \times Z), and then apply it to the
category of endofunctors with identity functor as I and composition as
\times, then you get a monad.



More information about the Haskell-Cafe mailing list