[Haskell-cafe] Re: evaluation semantics of bind
mail at justinbogner.com
mail at justinbogner.com
Thu Feb 5 11:26:16 EST 2009
Gregg Reynolds <dev at mobileink.com> writes:
> I think I've just about got monads figured out, but there's one detail that
> still escapes me. As I understand it, a monad is a kind of programming trick
> the uses data dependency to force evaluation order. x >>= f means apply f to
> x; since the value of f x depends on the value of x, the evaluator must
> evaluate x before f x. However, consider:
>
> getChar >>= \x -> getChar
>
x >>= f does not mean "apply f to x", it means "do x, and then do f with
the result of x". Bind is a sequencing operator rather than an
application operator.
More information about the Haskell-Cafe
mailing list