
#15712: GHC panic with -XDerivingVia -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Keywords: DerivingVia | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I slipped up and typed `Codensity GEndo` and now `Codensity (GEndo m)`, resulting in a GHC panic {{{#!hs {-# Language RankNTypes #-} {-# Language DerivingVia #-} import Control.Monad.Codensity import Data.Kind newtype GEndo m a = GEndo (m a -> m a) newtype LogicT m a = LogicT { runLogicT :: forall xx. (a -> (m xx -> m xx)) -> (m xx -> m xx) } deriving (Functor, Applicative, Monad) via (Codensity GEndo) }}} {{{ $ ghci -ignore-dot-ghci 476.hs GHCi, version 8.7.20180828: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( 476.hs, interpreted ) ghc-stage2: panic! (the 'impossible' happened) (GHC version 8.7.20180828 for x86_64-unknown-linux): ASSERT failed! Type-correct unfilled coercion hole {co_a2aG} Call stack: CallStack (from HasCallStack): callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable assertPprPanic, called at compiler/typecheck/TcHsSyn.hs:1716:99 in ghc:TcHsSyn Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
}}} Deriving via `Codensity (GEndo m)` works as expected. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15712 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler