semantics of Eq instance for Var.Var (was: is shadowing allowed in CoreSyn?)
Roman Leshchinskiy
rl at cse.unsw.edu.au
Thu Feb 17 09:11:44 CET 2011
On 17/02/2011, at 00:33, Adam Megacz wrote:
> Max Bolingbroke <batterseapower at hotmail.com> writes:
>>> Hrm, isn't it bad for two Var's with different fields to have the same
>>> uniq? Because if they have the same uniq, they will be Eq-equal.
>>
>> Just because two vars are eq-equal does not mean that they refer to
>> the "same thing".
>
> Hrm, okay, thanks for clearing this up... but, in that case, what
> exactly does it mean for two Vars to be Eq-equal?
Two Vars are Eq-equal iff they could shadow each other. That is, two Vars with the same Unique can't be in scope at the same time. So to compare two in-scope Vars, you just have to compare their Uniques. That's all (==) does.
Roman
More information about the Cvs-ghc
mailing list