strict bits of datatypes

Ross Paterson ross at soi.city.ac.uk
Tue Mar 20 16:39:07 EDT 2007


On Tue, Mar 20, 2007 at 01:53:47PM +0000, Malcolm Wallace wrote:
> Now, in the definition
>     x = x `seq` foo
> one can also make the argument that, if the value of x (on the lhs of
> the defn) is demanded, then of course the x on the rhs of the defn is
> also demanded.  There is no need for the `seq` here either.
> Semantically, the definition is equivalent to
>     x = foo
> I am arguing that, as a general rule, eliding the `seq` in such a case
> is an entirely valid and correct transformation.

You're talking about demand, WHNF, etc, but the Report doesn't; it
gives a simple denotational semantics for seq and recursive definitions,
according to which the first definition is equivalent to x = _|_.



More information about the Haskell-prime mailing list