[GHC] #12369: data families shouldn't be required to have return kind *, data instances should

GHC ghc-devs at haskell.org
Wed Jul 6 12:02:38 UTC 2016


#12369: data families shouldn't be required to have return kind *, data instances
should
-------------------------------------+-------------------------------------
           Reporter:  ekmett         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:  8.2.1
          Component:  Compiler       |           Version:  8.0.1
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I'd like to be able to define

 {{{#!hs
 {-# language PolyKinds, KindSignatures, GADTs, TypeFamilies #-}
 data family Fix :: (k -> *) -> k
 newtype instance Fix f = In { out :: f (Fix f) }
 }}}

 But currently this is disallowed:

 {{{
 Fix.hs:2:1: error:
     • Kind signature on data type declaration has non-* return kind
         (k -> *) -> k
     • In the data family declaration for ‘Fix’
 }}}

 Ultimately I think the issue here is that data __instances__ should be
 required to end in kind *, not the families, but this generalization
 didn't mean anything until we had `PolyKinds`.

 As an example of a usecase, with the above, I could define a bifunctor
 fixed point such as

 {{{#!hs
 newtype instance Fix f a = In2 { out2 :: f (Fix f a) a }
 }}}

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


More information about the ghc-tickets mailing list