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

Disappointment
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
 Date: -- (:) From: Andrej Bauer Subject: Re: [Caml-list] Disappointment
Axel PoignÃ© wrote:
> Maybe computer scientists obfuscate. The mathematical concept of monads
> however is dead simple (at least if interpreted in a world of sets):
>
> Let X be a set of values and let TX denote a set of "simple terms" over
> these values. A "simple term" may be thought of as either "an operator
> applied to a tuple of values" or "a value", e.g. "values" are 1,2,3,...
> and "simple terms" are  3,  +(3,5), ...
>
> Additionally to the "operator" T on sets there are two functions:
>
> -  \eta: X -> TX that turns a value into a "simple term", e.g. \eta(3) = 3
> -  \mu: TX -> X that computes the value of a "simple term", hence
> defines the semantics, e.g. \mu(+(3,5)) = 8.
>
> (T, \eta, and \mu) form a monad if

This is incorrect. You are describing some sort of a mutant between a
monad and an algebra for a functor T.

A monad T has a different \mu, namely a family of maps (one for each set X)

\mu_X : T (T X) -> T X

One such \mu takes a "simple term of simple terms over X" and flattens
it to a "simple term over X".

Andrej