[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 19:23:10 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 monoidal):

 Haskell 2010 clearly has empty data decls. We've got in section 4.2.1

 topdecl -> data [context =>] simpletype [= constrs] [deriving]

 Note that "= constrs" is in square brackets [] which denote optional part.

 There's also this part: "This declaration introduces a new type
 constructor T with zero or more constituent data constructors". Plus, the
 announcement of the standard contained a list of additions, including
 empty data declarations. If there's any contradicting information, I would
 call it a typo in the standard. However, there's a quirk: the deriving
 clause in H2010 is allowed only on nonempty data decls.

 I can't work on the ticket in this month - sorry. To the patch author: I
 think we should be consistent with Eq, Ord etc. One way would be removing
 cond_stdOK altogether. This should make conditions for standalone deriving
 and normal deriving completely equivalent, but it is overly permissive in
 regard to standard.

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




More information about the ghc-tickets mailing list