On Thu, Mar 31, 2011 at 7:29 AM, Daniel Fischer < [email protected]> wrote:
> Err, terminology problem here. > Strictly speaking, a function is strict iff > > f _|_ = _|_ > > while we are talking here about evaluation strategies, so we should better > have spoken of eager vs. deferred evaluation. > A non-strict function has different semantics from a strict one by > definition. > > If you have a strict function, you may evaluate its argument eagerly > without changing the result¹, while eager evaluation of a non-strict > function's argument may produce _|_ where deferred evaluation wouldn't. > This is almost but not entirely true. Consider f x = error "f is not implemented" Clearly, f _|_ = _|_, so f is strict. f (error "bang!") might, depending on how strictness analysis proceeds, generate an "f is not implemented" error or a "bang!" error. But that's only observable at the IO level, and the optimization is considered important enough, that potentially generating a different exception is allowed. I think this paper covers some of the details: http://research.microsoft.com/en-us/um/people/simonpj/papers/imprecise-exn.htm -- ryan
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
