From: Wojciech Meyer <wojciech.meyer@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] [ANN] omonad-0.0.1
Date: Wed, 23 Jan 2013 17:40:49 +0000 [thread overview]
Message-ID: <wfbocfyezi.fsf@gmail.com> (raw)
Hi,
I'm pleased to pre-release a small syntax extension for monadic programming
called omonad.
The major difference between omonad and pa_monad[_custom] is that omonad
does not use Camlp4 and is based on -ppx flag implemented on the current
trunk of the toolchain.
The monadic code can look like this:
let compute c =
Exception.(perform begin
a <-- return (1+2);
b <-- return (a+4);
return (b + a * c)
end)
in
let computation =
Exception.(perform begin
a <-- compute 10;
b <-- return (a - 37);
c <-- (perform begin
d <-- return 1;
return (d - 1)
end);
let divisor = b + c in if divisor = 0
then fail "Division by zero!"
else return (80 / divisor);
return (a+b)
end)
in
try print_int (Exception.run computation)
with Exception.Error str -> Printf.printf "Computation terminated with: '%s'\n" str
There is not much syntactical difference between pa_monad[_custom] and
omonad, so it brings to a light the same monadic programming
convenience and experience.
Tarball: http://danmey.org/omonad-0.1.0.tar.gz
Git repository: https://github.com/danmey/omonad
Issue & features: https://github.com/danmey/omonad/issues
OPAM packaging will follow up shortly.
Enjoy,
--
Wojciech Meyer
http://danmey.org
reply other threads:[~2013-01-23 17:40 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=wfbocfyezi.fsf@gmail.com \
--to=wojciech.meyer@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).