[GHC] #14042: Datatypes cannot use a type family in their return kind

GHC ghc-devs at haskell.org
Tue Aug 1 15:47:08 UTC 2017


#14042: Datatypes cannot use a type family in their return kind
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:  TypeInType,
      Resolution:                    |  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 > Can someone produce an example with some actual data constructors? I'm a
 bit lost as to the actual goal.

 This is the sort of thing that I want to write:

 {{{#!hs
 {-# LANGUAGE TypeFamilies #-}
 {-# LANGUAGE TypeInType #-}
 {-# LANGUAGE TypeOperators #-}
 import Data.Kind

 data Nat = Z | S Nat

 type family MkFun (args :: Nat) :: Type where
   MkFun Z     = Type
   MkFun (S n) = Type -> MkFun n

 data Foo (args :: Nat) :: MkFun args where
   MkFoo0 :: Foo Z
   MkFoo1 :: a -> Foo (S Z) a
   MkFoo2 :: a -> b -> Foo (S (S Z)) a b
 }}}

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


More information about the ghc-tickets mailing list