Skip to content

`No skolem error` panic with creative use of equality constraint in a standalone kind signature

This is a program:

{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstrainedClassMethods #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneKindSignatures #-}
module Bug where

import Data.Kind

type C :: forall (a :: Type) -> a ~ Int => Constraint
class C a where
  f :: C a => a -> Int

Don't ask me how I came up with this program. It just... sort of happened. GHC isn't too thrilled about it, either:

[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:14:8: error:ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.9.0.20191012:
        No skolem info:
  [a_asP]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1179:37 in ghc:Outputable
        pprPanic, called at compiler/typecheck/TcErrors.hs:2784:5 in ghc:TcErrors
Edited by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information