[GHC] #15310: Derive Generic1 instances for types of kind (k -> *) -> * that include applications of the parameter

GHC ghc-devs at haskell.org
Mon Jun 25 05:06:24 UTC 2018


#15310: Derive Generic1 instances for types of kind (k -> *) -> * that include
applications of the parameter
-------------------------------------+-------------------------------------
           Reporter:  cedricshock    |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  low            |         Milestone:
          Component:  Compiler       |           Version:
  (Type checker)                     |
           Keywords:  DeriveGeneric  |  Operating System:  Unknown/Multiple
  Generic1                           |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The `Generic1` class is polykinded. The `DeriveGeneric` extension can
 derive `Generic1` instances for types of kind `k -> *` parameterized over
 a parameter with a kind other than `k ~ *`, but only if they don't apply
 the parameter to other types.

 It currently cannot derive an instance for

 {{{#!hs
 newtype Fix f = In (f (Fix f))
   deriving (Generic1)
 }}}

 or for

 {{{#!hs
 data Child f = Child {
     ordinal :: Int,
     nickname :: f String
 }
   deriving (Generic1)
 }}}

 It's possible to represent these types generically, either with
 composition that can include occurrences of the parameter or with new
 types that represent applications of the parameter.

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


More information about the ghc-tickets mailing list