Re: Qualified variable in pattern: T.mkRoot

Malcolm Wallace <[email protected]> Wed, 29 Jun 2005 16:47:11 +0100
Newsgroups gmane.comp.lang.haskell.hat
Organization Dept of Computer Science, University of York
Message-ID <[email protected]>
Thomas Davie <[email protected]> writes:

> Okay, I see that, now I'm slightly intrigued -- if, as before, we have
> 
> Just foo = undefined
> 
> Doesn't that have 2 effects:
>   foo = undefined
>   undefined :: Maybe a
> 
> and thus cause a type error (i.e. undefined has become too specific)?

No, 'foo' does not literally gain the value of 'undefined'.  In fact,
foo gets no value at all, because the computation diverges before the
pattern can be matched.  /Semantically/ divergence is equivalent to
'undefined', but syntactically, 'foo' and 'undefined' are separate
bindings, and their types are therefore not constrained to be equal.

Regards,
    Malcolm