caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Which syntax is more ocaml-like?
@ 2005-08-22 18:21 Jacques Carette
  0 siblings, 0 replies; only message in thread
From: Jacques Carette @ 2005-08-22 18:21 UTC (permalink / raw)
  To: caml-list

Hello,

with Oleg Kiselyov, we are working on a better version of the monadic do 
syntax for Ocaml (the original message 
http://caml.inria.fr/pub/ml-archives/caml-list/2005/03/87cab0cdbbcfcf736b85d746ba610e78.en.html 
did not come through on the arhive, see 
https://mailman.rice.edu/pipermail/metaocaml-users-l/2005-March/000056.html 
for the same email but with the attachment intact.  
http://caml.inria.fr/pub/ml-archives/caml-list/2005/05/e85edd2308a0e58a7b0761962bc440c6.en.html 
is also relevant).  In particular, we want to handle multiple monads.  
Variations on two different themes have come up as possibilities:
1) doM Foo { ... }
2) doM with Foo in ...
   (where the 'with' could be dropped altogether).
For example if the ... above was a <- m; return a
then both of these would expand to
Foo.bind m (fun a -> return a)

The reason to use a module (with just one export) is for future 
extensibility, where we may want to require more functions of the Monad 
implementation; also, as has been demonstrated here and there, there are 
nice morphisms between ML-stype modules/functors and Haskell-stype type 
classes.

There could also be a special case with no Foo at all, which would then 
use the bind function in the current scope (if any).

Which of 1) or 2) above is more Ocaml-like?  Other comments?

Jacques


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-22 18:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-22 18:21 Which syntax is more ocaml-like? Jacques Carette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).