Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

[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 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
> 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
<http://www.lama.univ-savoie.fr/~raffalli/bindlib.html>

--
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
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature
---------------------------------------------

```