[GHC] #7401: Can't derive instance for Eq when datatype has no constructor, while it is trivial do do so.

GHC ghc-devs at haskell.org
Wed Jun 17 11:34:32 UTC 2015


#7401: Can't derive instance for Eq when datatype has no constructor, while it is
trivial do do so.
-------------------------------------+-------------------------------------
        Reporter:  jpbernardy        |                   Owner:  osa1
            Type:  feature request   |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Compiler          |                 Version:  7.6.1
      Resolution:                    |                Keywords:  deriving,
Operating System:  Unknown/Multiple  |  newcomer
 Type of failure:  GHC rejects       |            Architecture:
  valid program                      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:  Phab:D978
-------------------------------------+-------------------------------------

Comment (by jpbernardy):

 simonpj: I'm not sure we're talking about the same thing. The whole point
 of my request was that, for any class C a where all methods have an `a`
 argument, it is trivial to implement a meaningful instance C Foo for any
 empty type Foo.

 In fact, I am guessing that the instance generator for Eq and Ord generate
 case statements. So, one could just let the normal instance generator run,
 to get function definitions with
 empty case statements.

 I see now that the instance for Read is fine (because failure is the only
 option), but that is more than I was asking.

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


More information about the ghc-tickets mailing list