Without TypeInType, inconsistently accepts Data.Kind.Type but not type synonym
For convenience, I'll use GHCi to demonstrate flag behavior. First, we define a file:
{-# LANGUAGE TypeInType #-}
import Data.Kind
type Star = Type
newtype T k (t :: k) = T ()
Next, we load it up in GHCi, WITHOUT -XTypeInType
. Now we observe strange behavior:
ezyang@sabre:~$ ghc-8.0 --interactive C.hs
GHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( C.hs, interpreted )
Ok, modules loaded: Main.
*Main> :k T Type Int
T Type Int :: *
*Main> :k T Star Int
<interactive>:1:3: error:
• Data constructor ‘Star’ cannot be used here
(Perhaps you intended to use DataKinds)
• In the first argument of ‘T’, namely ‘Star’
In the type ‘T Star Int’
Of course, if we pass -TypeInType
to GHCi that fixes the problem (BTW, DataKinds
does NOT solve the problem.)