[GHC] #4369: No instances for Eq and Ord for Located e

GHC cvs-ghc at haskell.org
Tue Oct 5 14:18:43 EDT 2010


#4369: No instances for Eq and Ord for Located e
---------------------------------+------------------------------------------
    Reporter:  tibbe             |       Owner:              
        Type:  bug               |      Status:  new         
    Priority:  normal            |   Component:  GHC API     
     Version:  7.1               |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 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
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4369>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list