
5 Feb
2009
5 Feb
'09
11:26 a.m.
Gregg Reynolds
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.