On Wed, 13 Sep 1995 [EMAIL PROTECTED] wrote:

> Well, I'm glad to see I provoked some discussion!
...
> Why should foo evaluate its argument?  It sounds to me like
> Lennart is right, and I should not have let Simon lead me astray!
... 
> This is assuming I have understood Lennart correctly, and that
> 
>       foo (Age n) = (n, Age (n+1))
>       foo' a = (n, Age (n+1)) where (Age n) = a
> 
> are equivalent when Age is declared as a strict datatype. Unlike
> Sebastian or Simon, I believe it would be a disaster if for a newtype
> one had to distinguish these two definitions.

I don't see how these two can be equivalent, unless a special case is 
made in the semantics for data types with a single constructor when the
constructor happens to be strict. Consider

        data G = F !Int | D Int

        f :: G -> Bool
        f (D _) = True
        f (F _) = False

If Lennart is right about foo, doesn't it follow that

        f (D undefined) = True?

In which case, since D is strict, we have

        f undefined = f (D undefined) = True

and so, by monotonicity of f, f v = True for all v and, in particular,

        f (F e) = True

This can't be right, surely?

Sebastian


Reply via email to