Skip to content

Named wildcards require PartialTypeSignatures in visible kind applications, but not type applications

The following program typechecks:

{-# LANGUAGE NamedWildCards #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeApplications #-}
module Bug where

data P (a :: k) = MkP

f :: P Int
f = MkP @_k

However, if I use a named wildcard in a visible //kind// application, such as in the following variant of f:

g :: P @_k Int
g = MkP

Then GHC errors unless I enable PartialTypeSignatures:

$ ~/Software/ghc5/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:11:9: error:
    • Found type wildcard ‘_k’ standing for ‘*’
      To use the inferred type, enable PartialTypeSignatures
    • In the type signature: g :: P @_k Int
   |
11 | g :: P @_k Int
   |         ^^

It feels strangely inconsistent to require the language extension in one place but not the other.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information