Obscure type error message around kinds needs more information to be useful
If I say
{-# LANGUAGE PolyKinds #-}
module Bug where
import GHC.Exts
fTerm :: (Any :: TYPE r)
fTerm = undefined
then I get
Bug.hs:7:10: error:
• Quantified type's kind mentions quantified type variable
type: ‘Any’
where the body of the forall has this kind: ‘TYPE r’
• In the type signature: fTerm :: (Any :: TYPE r)
|
7 | fTerm :: (Any :: TYPE r)
| ^^^^^^^^^^^^^^^
This is true enough. But it's hard to action on. Much better would be
Bug.hs:7:10: error:
• Quantified type's kind mentions quantified type variable
type: ‘forall (r :: RuntimeRep). Any @(TYPE r)’
where the body of the forall has this kind: ‘TYPE r’
• In the type signature: fTerm :: (Any :: TYPE r)
|
7 | fTerm :: (Any :: TYPE r)
| ^^^^^^^^^^^^^^^
This new message requires -fprint-explicit-foralls -fprint-explicit-kinds -fprint-explicit-runtime-reps
. Any time this message is printed, all three of these dark corners will be in play, so let's just make them all unconditionally explicit.