9.2.3 GHCi "No skolem info" error from deriving-via with newtyped function
Summary
Possibly related to #14628. Given the following definition:
import Control.Monad.Trans.Reader (ReaderT(ReaderT))
newtype FooT m a = FooT
{ runFooT :: Int -> m a
} deriving (Functor) via (ReaderT Int m)
GHC 9.2.3 will build this without issue, but when it is loaded into ghci
, the following No skolem info
error is produced for the deriving
line:
error:ghc-9.2.3: panic! (the 'impossible' happened)
(GHC version 9.2.3:
No skolem info:
[k_a1mj]
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/Errors.hs:2912:17 in ghc:GHC.Tc.Errors
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
<no location info>: error:
Could not load module ‘Test.Package.F’
It is a member of the hidden package ‘test-package-f-0.0.0.0’.
You can run ‘:set -package test-package-f’ to expose it.
(Note: this unloads all the modules in the current scope.)
8.10.7 ghci
has no issue loading the definition.
Steps to reproduce
A repro repo is available here: https://github.com/jship/ghci-bug-deriving-via. This repo has 6 minimal test packages in two groups: packages A-C use GHC 8.10.7 and packages D-F use GHC 9.2.3.
All packages can be built via the repo's included build.sh
script. For ghci
testing: cd <specific-package-dir> && stack ghci
Expected behavior
I expect the loading of test-package-f
into ghci
(e.g. via stack ghci
from the test-package-f
directory) to be successful.
Environment
- GHC version used: Tested on 8.10.7 and 9.2.3. 9.2.3 is where the problem shows up.
Optional:
- Operating System:
macOS 12.3
and WSL2 (GNU/Linux 5.10.16.3-microsoft-standard-WSL2 x86_64
)