[GHC] #12422: Add decidable equality class

GHC ghc-devs at haskell.org
Fri Jul 22 13:49:11 UTC 2016


#12422: Add decidable equality class
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Core Libraries    |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Shouldn't this go via the libraries list?

 While what you have there works, I might prefer

 {{{#!hs
 type Refuted = a -> Void
 data Decision a = Yes a | No (Refuted a)

 class DecideEquality f where   -- name lines up with TestEquality
   decideEquality :: f a -> f b -> Decision (a :~: b)
 }}}

 This solution does have one more level of indirection, but it allows you
 to extract an `a :~: b` from the `Decision`, which will compose better
 with the other functions from `Data.Type.Equality`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12422#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list