RE: A propos de monad/About monads

From: Frank A. Christoph (christo@nextsolution.co.jp)
Date: Mon Oct 04 1999 - 10:40:10 MET DST


From: "Frank A. Christoph" <christo@nextsolution.co.jp>
To: "CAML Mailing list" <caml-list@inria.fr>
Subject: RE: A propos de monad/About monads
Date: Mon, 4 Oct 1999 17:40:10 +0900
In-Reply-To: <wd8n1u3v3c7.fsf@parate.irisa.fr>

> [ 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
at

http://haskell.org/bookshelf/

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
matter.

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.

--FAC



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET