On 8/9/07, ok <ok@cs.otago.ac.nz> wrote:
We get extra >>, >>=, \, ->, and "in" tokens, but no new parentheses.
Yes exactly. It's the >>= and >> that gets rid of the parentheses, and reverses the order of the operations.
I cant remember where I saw this, but somewhere there is a monad tutorial that starts really from the basics, which is that a "do" list is essentially something like:
f (g (h initialvalue ) )
... which we can rewrite as something like:
h initialvalue |> g |> f
.. for a suitable definition of |> , something like (off the top of my head, almost certainly wrong):
(|>) f g = g f