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

_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime

Reply via email to