
21 Nov
2008
21 Nov
'08
6:37 a.m.
Duncan Coutts
I guess we can try to simplify it to something like "evaluation happens here" (pseq) vs "evaluation happens here or before" (seq).
No, that is not correct, or at least it is highly misleading. The key difference between them is that: (x `pseq` y) = if y is not yet in WHNF, the compiler guarantees that x will be evaluated to WHNF before y. (x `seq` y) = if y is not yet in WHNF, the compiler can choose whether to evaluate y to WHNF before x, or x before y. In other words, pseq guarantees sequencing (given a side condition), whilst seq does not guarantee sequencing. Regards, Malcolm