GHCi's :kind doesn't work with wildcards
Witness this GHCi session:
rae:20:35:37 ~/ghc/ghc-head/ghc> ~/ghc/ghc-head/inplace/bin/ghc-stage2 --interactive
GHCi, version 8.7.20180716: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /Users/rae/.ghc/ghci.conf
Prelude> :set -XPartialTypeSignatures
Prelude> import Data.Proxy
Prelude Data.Proxy> :k Proxy _
Proxy _ :: *
Prelude Data.Proxy> :k Proxy (Maybe :: _)
<interactive>:1:8: error:
• Expecting one more argument to ‘Maybe’
Expected kind ‘_’, but ‘Maybe’ has kind ‘* -> *’
• In the first argument of ‘Proxy’, namely ‘(Maybe :: _)’
In the type ‘Proxy (Maybe :: _)’
It seems we're not doing the correct wildcard thing here: GHCi should report that _
should be Type -> Type
.
I believe that this is because TcHsType.tcWildCardBinders
uses newSkolemTyVar
internally; tcWildCardBinders
is called from TcRnDriver.tcRnType
, which is the implementation of GHCi's :kind
. This is GHC's only call of tcWildCardBinders
. All other places use tcWildCardBindersX newWildTyVar
, which makes vastly more sense.
I would just fix this myself, but it smells intentional. Does anyone know why we have all this?
(Credit to @int-index who found this bug.)