Skip to content

Panic! "No skolem info" using deriving-via

Create a file with the following contents and load it into GHCi:

{-# LANGUAGE DerivingVia #-}

import Data.Functor.Compose

newtype ReaderIO env a = ReaderIO (env -> IO a)
    deriving (Functor, Applicative) via (Compose ((->) a) IO)

Result:

GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( example.hs, interpreted )

example.hs:6:15: error:ghc: panic! (the 'impossible' happened)
  (GHC version 8.6.5 for x86_64-unknown-linux):
        No skolem info:
  [a_a1FF]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
        pprPanic, called at compiler/typecheck/TcErrors.hs:2891:5 in ghc:TcErrors

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Note that this code shouldn't actually compile (on the last line I accidentally wrote a instead of env).

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