* [Caml-list] [ANN] omonad-0.0.1
@ 2013-01-23 17:40 Wojciech Meyer
0 siblings, 0 replies; only message in thread
From: Wojciech Meyer @ 2013-01-23 17:40 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-01-23 17:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 17:40 [Caml-list] [ANN] omonad-0.0.1 Wojciech Meyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox