- -- Unqual < Qual < Orig
- -- We always convert Exact to Orig before comparing
- compare (Exact n1) (Exact n2) | n1==n2 = EQ -- Short cut
- | otherwise = nukeExact n1 `compare` nukeExact n2
- compare (Exact n1) n2 = nukeExact n1 `compare` n2
- compare n1 (Exact n2) = n1 `compare` nukeExact n2
-
-
- compare (Qual m1 o1) (Qual m2 o2) = (o1 `compare` o2) `thenCmp` (m1 `compare` m2)
- compare (Orig m1 o1) (Orig m2 o2) = (o1 `compare` o2) `thenCmp` (m1 `compare` m2)
+ -- Exact < Unqual < Qual < Orig
+ -- [Note: Apr 2004] We used to use nukeExact to convert Exact to Orig
+ -- before comparing so that Prelude.map == the exact Prelude.map, but
+ -- that meant that we reported duplicates when renaming bindings
+ -- generated by Template Haskell; e.g
+ -- do { n1 <- newName "foo"; n2 <- newName "foo";
+ -- <decl involving n1,n2> }
+ -- I think we can do without this conversion
+ compare (Exact n1) (Exact n2) = n1 `compare` n2
+ compare (Exact n1) n2 = LT
+
+ compare (Unqual _) (Exact _) = GT