Gregg Reynolds wrote: > I must be misunderstanding something. I don't know if it would be
optimized out, but I see no reason why it couldn't be. There's no data dependency, right?
Of course there is data dependency. In my example, where IO is defined as a (generalized) algebraic datatype, the value of getChar is GetChar. The value of 'getChar >>= \x -> getChar' is 'Bind GetChar (\x -> GetChar'. 'x' is not used anywhere, but this doesn't change the fact that these are totally different values, no sane compiler would prove them equal.
For some monads, the evaluation of 'a >>= \x -> b' yields b, but it's not true in general.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe