[GHC] #11357: Regression when deriving Generic1 on poly-kinded data family

GHC ghc-devs at haskell.org
Sat Mar 19 16:56:02 UTC 2016


#11357: Regression when deriving Generic1 on poly-kinded data family
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  goldfire
            Type:  bug               |               Status:  merge
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.11
  (CodeGen)                          |             Keywords:  Generics,
      Resolution:                    |  TypeInType, TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  GHC rejects       |            Test Case:
  valid program                      |  deriving/should_compile/T11357
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Well, that patch seemed to fix that problem, but it introduced another
 one. Vanilla datatypes and data family instances are still inconsistent
 w.r.t. which type variables are considered "instantiated" in a `Generic1`
 instance. For instance, this is rejected:

 {{{
 λ> data Proxy k (a :: k) = ProxyCon deriving Generic1

 <interactive>:32:43: error:
     • Can't make a derived instance of ‘Generic1 (Proxy *)’:
         Proxy must not be instantiated; try deriving `Proxy k a' instead
     • In the data declaration for ‘Proxy’
 }}}

 And rightfully so, since the visible kind binder `k` is instantiated to
 `*`. But now it's possible to have an equivalent instance for a data
 family that squeaks past this check!

 {{{
 λ> data family ProxyFam (a :: y) (b :: z)
 λ> data instance ProxyFam k (a :: k) = ProxyFamCon deriving Generic1

 ==================== Derived instances ====================
 Derived instances:
   instance GHC.Generics.Generic1 (Ghci13.ProxyFam *) where
     ...
 }}}

 I need to investigate further to see why this is the case.

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


More information about the ghc-tickets mailing list