"interact" behaves oddly if used interactively
Simon Marlow
simonmar at microsoft.com
Wed Oct 1 22:54:44 EDT 2003
> Yes, the presence of lazy IO makes optimistic evaluation more
> complicated, but I do not see that it compromises the purity of the
> language in anyway (whatever purity is ;-).
So, we're agreed that the presence of lazy evaluation makes implementing
optimistic evaluation (and other evaluation strategies) more
complicated. Personally, I find it disturbing that the presence of this
family of library functions affects something as low-level as the
evaluation strategy of the language. Or, to put it another way, it
enforces a particular evaluation strategy on a part of the language,
when the rest of Haskell makes no such restrictions.
I would expect, in a pure language, that I could reduce any expression
in a program to HNF (or _|_) without affecting the meaning of the
program. In Haskell, I can only do this so long as the expression
doesn't involve any lazy I/O.
The real problem is that lazy I/O injects side effects into the pure
world of expressions. Haskell has a perfectly good system for
encapsulating side effects - the IO monad. So why put these sneaky side
effects into pure values?
Cheers,
Simon
More information about the Haskell-Cafe
mailing list