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
[Caml-list] OCaml popularity
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-12 (16:58)
From: Christophe Raffalli <christophe.raffalli@u...>
Subject: [Caml-list] Monads was OCaml popularity

> My other big problem with Haskell was ... you guessed it: monads! I 
> must have read every introduction to monads that's available on line 
> (and there are at least half a dozen), but I still don't really 
> understand them. Without monads, you can't do any real work in 
> Haskell, and monads are universally acknowledged to be a difficult 
> concept. Yet every introductory text I have seen on Haskell insists 
> that you learn the theory of monads before you can learn how to do 
> things like I/O.

Maybe if people where calling monads by their real name: quasi-morphism 
:-) that would be better !

- A monad M is given by a mapping M from type to type,

a function apply : M (a -> b) -> M a -> M b

and a function unit : a -> M a

such that unit (f a) = apply (unit f) (unit a)

- A real morphism M would be given by a mapping M from type to type,

a function unit : a -> M a

such that unit (f a) = (unit f) (unit a)

But this to be true enforces
M (a -> b) = M a -> Mb otherwise the previous equation makes no sense.
So monads introduces apply to be less restrictive : the equation
M (a -> b) = M a -> M b is replaced by a function
apply : M (a -> b) -> M a -> Mb

But when you see that, it is like morphism in math. There are very few 
result true for a morphism/monads, and when you use a specific monad, 
you may/have better to forget that this is a monad (do you really need 
to know that x |-> exp x is a group morphisme to use it even if this is 
an important remark ?)

PS: the bindlib library for data-types with bound variables is a monad 

Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature