GHC 9.4 panic on a representation-polymorphic newtype instance
On GHC 9.4 and HEAD, the following program causes a panic:
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UnliftedNewtypes #-}
module T21544 where
import Data.Kind
import GHC.Exts
type N :: forall (r :: RuntimeRep) -> TYPE r -> TYPE r
data family N r a
newtype instance N r a = MkN a
foo :: Int# -> N IntRep Int#
foo = MkN
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.5.20220503:
isUnliftedType
a_aXy :: TYPE r_aXx
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\GHC\Utils\Panic.hs:182:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler\GHC\Core\Type.hs:2484:7 in ghc:GHC.Core.Type
isUnliftedType, called at compiler\GHC\Core\Opt\Simplify.hs:2900:5 in ghc:GHC.Core.Opt.Simplify
The program seems to be OK on GHC 9.2 and below.
Edited by sheaf