[Hat] Qualified variable in pattern: T.mkRoot

Thomas Davie tom.davie at gmail.com
Wed Jun 29 12:03:38 EDT 2005


On 29 Jun 2005, at 16:47, Malcolm Wallace wrote:

> Thomas Davie <tatd2 at kent.ac.uk> 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


More information about the Hat mailing list