[Haskell] monadic where
gale at sefer.org
Tue Sep 20 03:29:14 EDT 2005
John Meacham wrote:
> f x y
> | b > c = ...
> | c <= 0 && a > b = ...
> a = ...
> b <- ...
> c <- ...
> f x y = ...
> there is really no clean (IMHO) way to express this idiom otherwise,
What does this translate to (even if not clean)?
I am not sure I understand what this is supposed
It looks like the guards depend on things computed
inside the monad, so I guess you want the guard
code put at the end of the monadic code.
But then, by the time you get to the guards, you may
have already created side effects in the monad. So
running the second version of f after failing the
first version is not equivalent to running the second
version by itself. Or am I missing something?
More information about the Haskell