Composition Monad

Andre W B Furtado [email protected]
Mon, 18 Feb 2002 17:16:34 -0300


Hal Daume III wrote:
> I'm not sure exactly what you mean.  Say I have something like that, then
> what's the difference between saying:
>
> f = do { action1;
>          action2;
>          action3 }
>
> and simply
>
> f = do action3
>
> ?
>
> If the result of each of the actions is ignored for the following ones,
> why do we need to do this monadically?

If g is an IORef, for example, action1 can modify the content of this IORef,
but the reference itself is still the same. That's why I'd like to use the
SAME g to all actions, although the content of g will be changed.

-- Andre