Ticket #4369 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

No instances for Eq and Ord for Located e

Reported by: tibbe Owned by:
Priority: normal Milestone:
Component: GHC API Version: 7.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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

Change History

Changed 3 years ago by simonpj

  • status changed from new to merge

Your wishes are granted

Fri Oct 15 06:18:57 PDT 2010  simonpj@microsoft.com
  * Make (Located a) an instance of Eq, Ord
  
  Fulfils Trac #4369

    M ./compiler/basicTypes/SrcLoc.lhs -1 +1

We can merge this I think

Simon

Changed 3 years ago by igloo

  • status changed from merge to closed
  • resolution set to fixed

Merged.

Note: See TracTickets for help on using tickets.