pseq strictness properties
duncan.coutts at worc.ox.ac.uk
Fri Nov 21 05:02:43 EST 2008
On Thu, 2008-11-20 at 15:33 -0800, Don Stewart wrote:
> > I don't think I'm just speaking for myself when I say that pseq is
> > confusing and the docs similarly.
> > Given the type
> > a -> b -> b
> > we would assume that it is lazy in it's first arg and strict in the
> > second. (Even in the presence of seq we know that it really really must
> > be strict in it's second arg since it returns it or _|_ in which case
> > it's still strict).
> > Of course we know of the seq primitive with this type that is strict in
> > both. However we also now have pseq that has the _opposite_ "static"
> > strictness to the original expected strictness.
> Could you state "static" strictness as a StrictCheck property?
> I'm not quite sure what this distinction means, actually.
Note that you could make the actual and declared strictness match each
other more closely by defining pseq to have the type:
pseq :: a -> b -> (# b #)
Now it's clear that it returns the second argument unevaluated. Of
course that'd be a lot less convenient to use.
More information about the Glasgow-haskell-users