[GHC] #9526: Add missing Generic instances in base

GHC ghc-devs at haskell.org
Tue Mar 22 12:57:56 UTC 2016


#9526: Add missing Generic instances in base
-------------------------------------+-------------------------------------
        Reporter:  nh2               |                Owner:  dreixel
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Core Libraries    |              Version:  7.8.3
      Resolution:  wontfix           |             Keywords:  Generics
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #10512            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * related:   => #10512


Comment:

 Sorry, my bad. I linked the wrong issue. It should be #10512, where
 `Generic` instances were proposed for `Int32` and `Word64`. The resolution
 of that issue is wontfix, and in GHC 8.0, the `Generic` instances for
 `Char`, `Float`, `Double`, and `Int`
 [https://ghc.haskell.org/trac/ghc/ticket/10512#comment:7 will be removed].

 Pedro outlines the reasons for not including `Generic` instances for
 primitive types [https://ghc.haskell.org/trac/ghc/ticket/10512#comment:3
 here]. Basically, `Generic` instances are intended for inspecting the
 structure of regular, structured algebraic data types until you get down
 to the "leaves" of a data structure. The leaves only require //ad hoc//
 instances of the base class, not of `Generic`.

 Moreover, the previous `Generic` instances base types were lying to users.
 Previously, we had something like this:

 {{{#!hs
 type Rep Char = D1 D_Char (C1 C_Char (S1 NoSelector (Rec0 Char))
 }}}

 But according to the rules of how `Generic` operates, that would suggest
 that `data Char = Char Char`, which is absolutely not the case. To avoid
 this dishonesty, we decided to remove the offending instances altogether.

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


More information about the ghc-tickets mailing list