
20 Mar
2007
20 Mar
'07
4:39 p.m.
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 = _|_.