Skip to content

GHC panic

ghc-9.2.2, I don't know if this has been fixed

{-# Language ConstraintKinds #-}
{-# Language PatternSynonyms #-}
{-# Language ViewPatterns #-}
{-# Language TypeOperators #-}
{-# Language GADTs #-}
{-# Language PolyKinds #-}
{-# Language KindSignatures #-}
{-# Language ScopedTypeVariables #-}
{-# Language TypeApplications #-}

module GHC.Generics.Explicit where

import Data.Type.Equality
import Data.Kind
import Type.Reflection
import GHC.Generics

pattern IsV1 <- (isV1 -> Just HRefl)

isV1 :: TypeRep rep -> Maybe (V1 :~~: rep)
isV1 = eqTypeRep @(Type -> Type) @(Type -> Type) (typeRep @V1)

produces

ghci> :r
[1 of 1] Compiling GHC.Generics.Explicit ( src/GHC/Generics/Explicit.hs, interpreted )
ghc: panic! (the 'impossible' happened)
  (GHC version 9.2.2:
	NoFlexi
  k_a46D[tau:1] :: *
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Tc/Utils/Zonk.hs:1932:18 in ghc:GHC.Tc.Utils.Zonk

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information