[GHC] #11732: Deriving Generic1 interacts poorly with TypeInType

GHC ghc-devs at haskell.org
Mon Mar 21 15:45:59 UTC 2016


#11732: Deriving Generic1 interacts poorly with TypeInType
-------------------------------------+-------------------------------------
           Reporter:  goldfire       |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
           Keywords:  TypeInType,    |  Operating System:  Unknown/Multiple
  Generics                           |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 From @RyanGlScott, comment:9:ticket:11357:

 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
     ...
 }}}

 [Ryan needs] to investigate further to see why this is the case.

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


More information about the ghc-tickets mailing list