Skip to content

GHC 9.6 panics about kindPrimRep

Summary

GHC 9.6.0.20230111 (alpha 1) fails with kindPrimRep panic.

Steps to reproduce

Save this as Foo.hs:

{-# LANGUAGE GADTs #-}
{-# OPTIONS_GHC -O #-}

module Lib where

data Foo a where
  Foo :: Foo Int

data Bar a = Bar a (Foo a)

data Some t = forall ix. Some (t ix)

instance Show (Some Bar) where
  show (Some (Bar v t)) = case t of
    Foo -> show v

Run

$ ghc-9.4 Foo.hs
[1 of 1] Compiling Lib              ( Foo.hs, Foo.o )
$ ghc-9.6 Foo.hs
[1 of 1] Compiling Lib              ( Foo.hs, Foo.o )

<no location info>: error:
    panic! (the 'impossible' happened)
  GHC version 9.6.0.20230111:
	kindPrimRep
  k_aDP
  typePrimRep (ix_aDW :: k_aDP)
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Types/RepType.hs:588:5 in ghc:GHC.Types.RepType
  CallStack (from HasCallStack):
    panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error

Expected behavior

I'd expect GHC 9.6 to succeed, similar to GHC 9.4.

Environment

  • GHC version used: GHC 9.6.0.20230111 (alpha 1)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information