Skip to content

Commit 9ff9176

Browse files
committed
Don't use raw in comparisons.
1 parent a378c99 commit 9ff9176

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Language/Rust/Data/Ident.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ data Ident
3333
= Ident { hash :: {-# UNPACK #-} !Int -- ^ hash for quick comparision
3434
, name :: Name -- ^ payload of the identifier
3535
, raw :: Bool -- ^ whether the identifier is raw
36-
} deriving (Data, Typeable, Generic, NFData, Eq, Ord)
36+
} deriving (Data, Typeable, Generic, NFData)
37+
38+
instance Eq Ident where
39+
x == y = (hash x, name x) == (hash y, name y)
40+
41+
instance Ord Ident where
42+
compare x y = compare (hash x, name x) (hash y, name y)
3743

3844
-- | Shows the identifier as a string (for use with @-XOverloadedStrings@)
3945
instance Show Ident where

0 commit comments

Comments
 (0)