[GHC] #15712: GHC panic with -XDerivingVia
GHC
ghc-devs at haskell.org
Fri Oct 5 22:21:19 UTC 2018
#15712: GHC panic with -XDerivingVia
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.1
Resolution: | Keywords: DerivingVia
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:
Old description:
> 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.
New description:
I slipped up and typed `Codensity GEndo` instead of `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#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list