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

#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 osa1):
(1) and (2) are done(will push commits soon). For (3), I think it may
break
some things. I found this NOTE in compiler/types/TyCon.hs:
{{{
Note [Enumeration types]
~~~~~~~~~~~~~~~~~~~~~~~~
We define datatypes with no constructors to *not* be
enumerations; this fixes trac #2578, Otherwise we
end up generating an empty table for
<mod>_<type>_closure_tbl
which is used by tagToEnum# to map Int# to constructors
in an enumeration. The empty table apparently upset
the linker.
Moreover, all the data constructor must be enumerations, meaning
they have type (forall abc. T a b c). GADTs are not enumerations.
For example consider
data T a where
T1 :: T Int
T2 :: T Bool
T3 :: T a
What would [T1 ..] be? [T1,T3] :: T Int? Easiest thing is to exclude
them.
See Trac #4528.
}}}
See also trac #2578.
Relevant commits:
{{{
commit 409e4d9f59dece1c21434191459c96b3e355faa9
Author: Ian Lynagh
participants (1)
-
GHC