Re: Qualified variable in pattern: T.mkRoot
Thomas Davie <[email protected]> Wed, 29 Jun 2005 17:03:38 +0100
| Newsgroups | gmane.comp.lang.haskell.hat |
|---|---|
| Message-ID | <[email protected]> |
On 29 Jun 2005, at 16:47, Malcolm Wallace wrote: > 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. Okay, but does this not force undefined to have the type Maybe a? i.e. Just x = undefined File y = undefined would cause a type error? Bob