
On 7/13/07, Michael Vanier
Stefan,
Thanks for your comments, as always.
What I meant by really-truly-absolutely-I-mean-right-now-seq is something that would evaluate its argument as far as it is possible to do so i.e. something that forces strict evaluation of an argument. That's what I thought seq did, but now I see I was wrong; it only "goes one deep" as it were. In fact, as you say, seq is not defined in terms of evaluation; all that it guarantees is that its first argument is either (a) bottom, in which the result of the entire seq is bottom, or (b) not bottom. To do so it has to evaluate the first argument only far enough to show bottom-ness or not, which is not strict evaluation as I understand it. So am I right in saying that Haskell has no way to force strict evaluation? Or am I confused as to the correct definition of "strict"?
A function f is strict if f _|_ = _|_ -- seq, as defined in Haskell, is strict in its first argument. So seq does force strict evaluation. Even if you define "strict evaluation" as evaluating a structure completely or returning _|_, then you can certainly force strict evaluation in Haskell -- but you can't write a polymorphic function that does so, unless you use type class overloading. Cheers, Tim -- Tim Chevalier* catamorphism.org *Often in error, never in doubt "'There are no atheists in foxholes' isn't an argument against atheism, it's an argument against foxholes." -- James Morrow