Newtype instance typechecks normally, but fails to typecheck when UnliftedNewtypes is enabled
This perfectly ordinary newtype instance
compiles:
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
-- {-# LANGUAGE UnliftedNewtypes #-}
module Bug where
import Data.Kind
data family Foo :: Type -> Type
newtype instance Foo :: Type -> Type where
MkFoo :: a -> Foo a
However, if you uncomment the {-# LANGUAGE UnliftedNewtypes #-}
line, then it fails to compile!
GHCi, version 8.9.0.20190614: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:10:3: error:
• Expected kind ‘* -> *’, but ‘a’ has kind ‘*’
• In the definition of data constructor ‘MkFoo’
In the newtype instance declaration for ‘Foo’
|
10 | MkFoo :: a -> Foo a
| ^^^^^^^^^^^^^^^^^^^