Deriving via crashes with a panic when mentioning skolems that are unbound in the instance
Summary
Deriving via crashes with a panic when mentioning skolems that are unbound in the instance
Steps to reproduce
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
import Control.Monad.Reader (ReaderT(ReaderT))
newtype RaftT m a = Raft
{ runRaftT :: a -> m a
}
deriving (Functor, Applicative, Monad) via ReaderT a m
GHC responds with a panic:
'impossible' happened)
(GHC version 8.8.4 for x86_64-unknown-linux):
No skolem info:
[a_a4nzl[sk:1]]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
pprPanic, called at compiler/typecheck/TcErrors.hs:2935:5 in ghc:TcErrors
Expected behavior
A reasonable error, saying something like "a
isn't in scope when producing Functor (Raft m)
"
Environment
- GHC version used: 8.8.4
Optional:
- Operating System: Archlinux
- System Architecture: x86_64