Skip to content

Panic with orphan instance on 9.0

This is a bug in 9.0 that is apparently fixed in 9.2+. However, it hasn't been reported so far, so I'm ticketing it just in case.

Given one-line Main.hs

instance Num Bool

load ghci -this-unit-id my-package -Wno-missing-methods Main and use :l Main:

$ ghci -this-unit-id my-package -Wno-missing-methods Main
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( Main.hs, interpreted )
Failed to load interface for ‘Main’
no unit id matching ‘main’ was found
ghci> :l Main
[1 of 1] Compiling Main             ( Main.hs, interpreted )
ghc: panic! (the 'impossible' happened)
  (GHC version 9.0.2:
	lookupVers1
  Main $fNumBool
  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/Iface/Recomp.hs:1455:19 in ghc:GHC.Iface.Recomp

Credits to Dominic Steinitz for the initial report.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information