Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
A propos de monad
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Frank A. Christoph <christo@n...>
Subject: RE: A propos de monad/About monads
> [ English (executive summary ;) ]
> Monads are a way to encapsulate side-effects in functionnal
> languages. Does anyboody have a more detailed explaination about how
> monads really work ? What is the difference between the usual let and
> the monad binding ?

Someone already gave a URL for Noel Winstanley's presentation of monads in
Haskell. I wanted to point out that there are several other resources listed

under "Using Monads".

Philippe Esperet wrote:
> 	``monad'' est le mot anglais correspondant ·<< monade >>, entit·
> complexe intervenant dans le syst?e philosophique de Leibniz (Monade
> en allemand).

I don't understand French, but I parsed this as saying that monads in the
sense used here have something to do with Leibniz's philosophical theory of
monads, which is false.

A monad, as used in Haskell and the progamming language theory literature,
is a mathematical structure from category theory. One way to think of it is
as a (polymorphic) computation over algebras of a functor.

Leibniz's monads were a semi-mystical attempt at explaining the structure of

You might think that at least the origins of the words are related, but I
doubt it. Another way to think of the notion of monad is as a
categorification of the algebraic notion of monoid (the functions become
functors, the points become morphisms, etc.), so I assume "monad" came from
"monoid". BTW, another word for "monad" is "triple" (because it is described
by one functor and two natural transformations), and I believe the latter is
in fact more common in pure mathematical circles.

David Brown wrote:
> Monads are primarily to encourage a lasy language (such as haskell) to
> evaluate side-effecting operations in a specific order.

But monads are also used in Opal, which is an eager language, to keep the
base language pure from side-effects.

Also, I often use monads in Haskell which have no side-effects at all. For
example, I might use a non-imperative state transformer to "lay out the
plumbing" for an algorithm, i.e., to avoid passing variables around
explicitly; the error monad, which is a monad over what in Ocaml corresponds
to the option type (functor), is also extremely useful, and has no
side-effects either.