[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
Fri Aug 16 21:48:44 CEST 2013


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

Comment (by simonpj):

 OK, yes, I missed the `[ = constrs ]` part of the grammar. Yes,
 `EmptyDataDecls` is part of H2010.

 And yes, clause (6) in the
 [http://www.haskell.org/onlinereport/haskell2010/haskellch11.html#x18-18200011
 deriving appendix] explicitly dis-allows `deriving( Eq )`, but here I
 think it would be OK for GHC to be a little more generous than the
 standard.  That is, with `EmptyDataDecls` (or `Haskell2010`) we'd accept
 {{{
 data T deriving( Eq )
 }}}
 whereas H2010 would reject it.  But failing to reject is very unlikely to
 break anyone's code.

 Simon

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




More information about the ghc-tickets mailing list