]>
On Fri, 25 Jul 2008 20:29:12 +0100, Dawid Toton wrote:
>
> Let me show an example of what I exactly mean. I start with a code:
>
> 1: let a = heavy 1
> 2: let b = heavy 2
> 3: let c = report (a + b)
> 4: let d = heavy 4
> 5: let e = heavy d
>
> Then I want to translate it automatically so that three applications of
> heavy are evaluated (lines 1, 2, 4). The addition a + b won't be
> evaluated untill a and b are successfully returned. (...)
You may want to have a look to
http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/
especially the "Russian Nesting Doll Monads" section for ideas.
Regards,
ChriS