[GHC] #4896: Deriving Data does not work for attached code

GHC ghc-devs at haskell.org
Tue Dec 2 13:27:37 UTC 2014


#4896: Deriving Data does not work for attached code
-------------------------------------+-------------------------------------
              Reporter:  mitar       |            Owner:
                  Type:  bug         |           Status:  infoneeded
              Priority:  low         |        Milestone:  7.10.1
             Component:  Compiler    |          Version:  7.1
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:              |       Blocked By:
  None/Unknown                       |  Related Tickets:
             Test Case:              |
  deriving/should_compile/T4896      |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"863854a3a490afd9e3ecf0da6294a3b078f4a6a1/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="863854a3a490afd9e3ecf0da6294a3b078f4a6a1"
 Fix another bug in deriving( Data ) for data families; Trac #4896

 If we have

    data family D a
    data instance D (a,b,c) = ... deriving( Data )

 then we want to generate

    instance ... => Data (D (a,b,c)) where
      ...
      dataCast1 x = gcast1 x

 The "1" here comes from the kind of D.  But the kind of the
 *representation* TyCon is

    data Drep a b c = ....

 ie Drep :: * -> * -> * -> *

 So we must look for the *family* TyCon in this (rather horrible)
 dataCast1 / dataCast2 binding.
 }}}

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


More information about the ghc-tickets mailing list