I definitely support the inclusion of Monad-related features to Ocaml. However, without some syntactic sugar, this is
rather difficult to use.
I have discussed this in a previous message to this list [which unfortunately cannot be retrieved from the caml-list
archives because somehow multipart/MIME messages are not handled properly by the archiver]. However, it is archived
here:
https://mailman.rice.edu/pipermail/metaocaml-users-l/2005-March/000056.html
The camlp4 extension above has some flaws (as pointed out to me by Lydia van Dijk):
1) extra { } that are not needed
2) which monad is used is unclear
3) using multiple monads in the same program is difficult
Very helpfully, Lydia has provided me with an updated version of pa_monad.ml that fixes these. I unfortunately have
not had the time to convert all my monadic programs to this new notation - as a "real" test that the new notation does
work. As soon as I confirm this, I will send an email to caml-list with this improved notation.
Having a standard library of Monads that can easily be used with a monadic 'do' notation in Ocaml would definitely be
very nice.
Interestingly, here Ocaml can do something which cannot be done in Haskell: it is possible to use the object system to
encapsulate Monads in a novel way. Because objects are first-class in Ocaml, a lot more can be done with them than in
Haskell, where one must live within the confines of the typeclass system for manipulating Monads. While I have not
explored this enough, 'Monad Transformers' could become much easier to do in Ocaml than in Haskell!
Jacques