$ ghc-9.2.2 Main.hs Foo.hs [1 of 2] Compiling Foo ( Foo.hs, Foo.o, Foo.dyn_o ) [2 of 2] Compiling Main ( Main.hs, Main.o, Main.dyn_o ) ghc: panic! (the 'impossible' happened) (GHC version 9.2.2: refineFromInScope InScope {wild_00 $dQuote_a2Jf} $tcT 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/Core/Opt/Simplify/Env.hs:706:30 in ghc:GHC.Core.Opt.Simplify.Env Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug