Skip to content

No instances for Eq and Ord for Located e

There are no Eq and Ord instances for Located e. Such instances would be useful for storing a Located e in e.g. a Set. I propose the two following instances:

instance Eq e => Eq (Located e) where
    L loc1 e1 == L loc2 e2 = loc1 == loc2 && e1 == e2

instance Ord e => Ord (Located e) where
    compare (L loc1 e1) (L loc2 e2) = case compare loc1 loc2 of
        LT -> LT
        GT -> GT
        EQ -> compare e1 e2
Trac metadata
Trac field Value
Version 7.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHC API
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information