Data family declarations don't adhere to the UnliftedNewtypes spec
According to the text of the UnliftedNewtypes proposal:
Data Families: Data families currently do not allow unlifted return kinds. This means that the following is rejected by the compiler:
data family Foo (a :: Type) :: TYPE 'IntRepUnder this proposal, this restriction would be lifted, not only in modules where
UnliftedTuples[sic] is enabled, but everywhere. Although defining the data families itself would not require the extension, defining instances would.
(I'm pretty sure that should say UnliftedNewtypes, not UnliftedTuples. I'll assume as much from here on.)
Despite the spec's claim that this restriction would be lifted "everywhere", GHC currently does not permit Foo without first enabling UnliftedNewtypes:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
import Data.Kind
import GHC.Exts
data family Foo (a :: Type) :: TYPE 'IntRep
$ ~/Software/ghc5/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:8:1: error:
• Kind signature on data type declaration has non-*
and non-variable return kind
TYPE 'IntRep
• In the data family declaration for ‘Foo’
|
8 | data family Foo (a :: Type) :: TYPE 'IntRep
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
$ ~/Software/ghc5/inplace/bin/ghc-stage2 Bug.hs -XUnliftedNewtypes
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Fixing this won't be too difficult, as it simply involves removing a validity check.