[Hat] Qualified variable in pattern: T.mkRoot

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Jun 29 11:47:11 EDT 2005

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.


More information about the Hat mailing list