Skip to content

"No skolem info" panic with PolyKinds

Summary

Making a class with a kind-polymorphic parameter and a single method can lead to a GHC panic stating "No skolem info".

Steps to reproduce

The following program

{-# LANGUAGE PolyKinds #-}

data Proxy a = Proxy

class Foo (t :: k) where foo :: Proxy (a :: t)

results in the error

Bug.hs:5:40: error:ghc: panic! (the 'impossible' happened)
  (GHC version 8.11.0.20200215:
        No skolem info:
  [k_a1q3[sk:1]]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1187:37 in ghc:Outputable
        pprPanic, called at compiler/typecheck/TcErrors.hs:2793:17 in ghc:TcErrors

On 8.6.5, it instead emits the error message

Bug.hs:5:45: error:
    • Expected a type, but ‘t’ has kind ‘k’
    • In the kind ‘t’
      In the first argument of ‘Proxy’, namely ‘(a :: t)’
      In the type signature: foo :: Proxy (a :: t)
  |
5 | class Foo (t :: k) where foo :: Proxy (a :: t)
  |

I thought at first it might be #16245 (closed) but for the facts that that issue specifically mentions RankNTypes, and produces an error already on GHC 8.6, which this example doesn't.

Expected behavior

It should probably emit the same error message it emitted in 8.6.

Environment

  • GHC versions used: 8.8.1, HEAD
  • Does not happen on 8.6.5

Optional:

  • Operating System: linux
  • System Architecture: x86_64
Edited by Jakob Brünker
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information