seq vs. pseq

Seth Kurtzberg seth at cql.com
Mon Nov 6 13:28:27 EST 2006


On Mon, November 6, 2006 9:21 am, Ross Paterson wrote:
> On Mon, Nov 06, 2006 at 01:53:52PM +0000, Malcolm Wallace wrote:
>> So the doubly bizarre thing is that, actually, `seq` does not control
>> the evaluation order (which is the only valid reason for wanting to use
>> it in the first place), but nevertheless it undesirably changes the
>> semantics of programs such that equational reasoning no longer holds.
>
> When I've used seq, it's to ensure that a function is strict in that
> argument, and therefore has been evaluated before the function is called.
> (If the language had unlifted types, I might have used those instead).
> Beyond that, I don't care exactly when it was evaluated; it might be
> long before, thanks to propagation of strictness information.
>
> seq has a clear denotational semantics.  One can still do equational
> reasoning with it, though there will be side conditions about whether
> something is _|_ or not.  The downside is that the eta rules get such
> side conditions, and polymorphic seq greatly weakens parametricity.
>
> Apart from that, the only thing wrong with seq is its name.

What would be the correct way to get the effect that he expected from seq?

>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
>


-- 
Seth Kurtzberg
seth at cql.com
Software Engineer
Specializing in Reliability and Security




More information about the Glasgow-haskell-users mailing list