pseq strictness properties

Simon Marlow marlowsd at
Fri Nov 21 06:31:51 EST 2008

Duncan Coutts wrote:
> On Fri, 2008-11-21 at 10:53 +0000, Simon Marlow wrote:
>> The docs probably shouldn't say anything about what the compiler sees, it 
>> should stick to what the programmer sees.  Duncan - do you want to try 
>> rewording it?
> Hmm, though the difference is really in what transformations you want
> the compiler not to do. I would not say the operational behaviour is
> actually different. Used in isolation there's really no way to
> distinguish them, even using trace and other tricks to observe the
> evaluation order.

Yes, to be more precise, the difference is in what *guarantees* you get 
about operational behaviour.  You might be able to observe a difference 
with trace, or you might not, depending on what the compiler did.  Using 
trace you will always observe pseq's first argument evaluated before its 
second, that's not true of seq.

> I guess we can try to simplify it to something like "evaluation happens
> here" (pseq) vs "evaluation happens here or before" (seq).

Ok, but we need to be careful: it would be wrong to talk about ordering at 
all with respect to seq, since it tells you nothing about ordering.  The 
implementation might be using a non-lazy evaluation strategy, for example.


More information about the Glasgow-haskell-users mailing list