deeqSeq proposal

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Wed Apr 5 16:02:17 EDT 2006


Andy Gill wrote:
> - [various reasons for deepSeq]

You left out the one that most interests me: ensuring that there are no 
exceptions hiding inside a data structure.

> deepSeq :: a -> b -> b

This ties demand for the (fully evaluated) normal form of an expression to 
demand for the WHNF of a different expression, which is a bit weird. I think 
it's cleaner for the primitive to be your "strict", which ties demand for 
the normal form of an expression to demand for the WHNF of the same 
expression. In fact I'd argue that "deepSeq" should not be provided at all 
(though of course it can be defined by the user). The analogy with seq is a 
bit misleading---deepSeq is a lot less symmetric than seq. The expressions 
(x `deepSeq` y `deepSeq` z) and (strict x `seq` strict y `seq` z) are 
equivalent, but only the latter makes it clear that z doesn't get fully 
evaluated.

-- Ben



More information about the Haskell-prime mailing list