From: Jacques Carette <carette@mcmaster.ca>
To: caml-list@inria.fr
Subject: Which syntax is more ocaml-like?
Date: Mon, 22 Aug 2005 14:21:32 -0400 [thread overview]
Message-ID: <430A17AC.90303@mcmaster.ca> (raw)
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
reply other threads:[~2005-08-22 18:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=430A17AC.90303@mcmaster.ca \
--to=carette@mcmaster.ca \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox