Hi all,

I just found myself in the need of Uniquable instance for RdrName. I'm 
surprised that such 
instance does not exist already because other datatypes like Name or OccName 
already have 
Uniquable instances. So, is there a reason why Uniquable instance for RdrName 
does not exist 
already (other than "it wasn't needed")? How should such an instance look like? 
I made an 
attempt:

rdrNameUnique :: RdrName -> Unique
rdrNameUnique (Unqual occName) = getUnique occName
rdrNameUnique (Qual _ occName) = getUnique occName
rdrNameUnique (Orig _ occName) = getUnique occName
rdrNameUnique (Exact name    ) = getUnique name

But I suspect this might be wrong:
- cases 1 and 4 simply return a Unique for the OccName/Name stored inside 
RdrName. I think this 
will assign the same Unique to RdrName and corresponding OccName/Name. Is this 
allowed?
- cases 2 and 3 ignore the Module stored inside RdrName. Again, this assigns 
the RdrName with a 
Unique identical to OccNames stored inside it.

Help appreciated.

Janek
_______________________________________________
ghc-devs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-devs

Reply via email to