Skip to content

GHC 9.0.1 panic with linear types + GADTs

Summary

Panic occurs with some combination of GADTs with linear types and class instances

ghc: panic! (the 'impossible' happened)
  (GHC version 9.0.1:
        No skolem info:
  [p_aVC[ssk:3]]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Outputable.hs:1230:37 in ghc:GHC.Utils.Outputable
        pprPanic, called at compiler/GHC/Tc/Errors.hs:2810:17 in ghc:GHC.Tc.Errors

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

Steps to reproduce

class X a where
  type A a :: Type
  type B a :: Type
  f        :: a %1 -> C a

-- Eiher: commenting this out makes it better
instance (X b0, X b1) => X (b0,b1) where
   type A (b0,b1) = (A b0, A b1)
   type B (b0,b1) = (B b0, B b1)
   pureC (b0,b1) = C (\(x,y) -> (f b0 & \case C g -> g x, f b1 & \case C g -> g y))

-- Or: so does changing this arrow to normal
data C a where
  C :: (X a) => (A a %p-> B a)  C a

These extensions are in play:

  • GADTs
  • LambdaCase
  • LinearTypes
  • TypeFamilies
  • UnicodeSyntax

Expected behavior

No crash

Environment

  • GHC version used: 9.0.1

Optional:

  • Operating System: Ubuntu 20.04
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information