[GHC] #15625: GHC panic, with QuantifiedConstraints

GHC ghc-devs at haskell.org
Tue Sep 11 13:28:39 UTC 2018


#15625: GHC panic, with QuantifiedConstraints
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.1-beta1
      Resolution:                    |             Keywords:
                                     |  QuantifiedConstraints
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 got a GHC Panic (I made some minor changes to GHC so it may have been
> added by me) but I think it's caused by the quality constraint
>
> {{{
> $ ~/code/latestghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci
> ~/hs/390.hs
> GHCi, version 8.7.20180828: http://www.haskell.org/ghc/  :? for help
> [1 of 1] Compiling Main             ( /home/baldur/hs/390.hs, interpreted
> )
> ghc-stage2: panic! (the 'impossible' happened)
>   (GHC version 8.7.20180828 for x86_64-unknown-linux):
>         ASSERT failed!
>   co_a2DG
>   df_a2DS @ Any
>   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/coreSyn/CoreSubst.hs:189:49 in
> ghc:CoreSubst
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
>
> >
> }}}
>
> given this code
>
> {{{#!hs
> {-# Language RankNTypes, TypeInType, DataKinds, PolyKinds, TypeOperators,
> GADTs, FlexibleInstances, MultiParamTypeClasses, ConstraintKinds, CPP,
> UndecidableSuperClasses, QuantifiedConstraints, FlexibleContexts #-}
>
> import Data.Kind
>
> type Cat ob = ob -> ob -> Type
>
> data KLEISLI (m :: Type -> Type) :: Cat (KL_kind m) where
>   MkKLEISLI :: (a -> m b) -> KLEISLI(m) (KL a) (KL b)
>
> data KL_kind (m :: Type -> Type) = KL Type
>
> class    (a ~ KL xx) => AsKL a xx
> instance (a ~ KL xx) => AsKL a xx
>
> ekki__ :: Monad m => (forall xx. AsKL a xx) => KLEISLI m a a
> ekki__ = MkKLEISLI undefined
> }}}

New description:

 I got a GHC Panic (I made some minor changes to GHC so it may have been
 added by me) but I think it's caused by the equality constraint

 {{{
 $ ~/code/latestghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci
 ~/hs/390.hs
 GHCi, version 8.7.20180828: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( /home/baldur/hs/390.hs, interpreted
 )
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 8.7.20180828 for x86_64-unknown-linux):
         ASSERT failed!
   co_a2DG
   df_a2DS @ Any
   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/coreSyn/CoreSubst.hs:189:49 in
 ghc:CoreSubst

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

 >
 }}}

 given this code

 {{{#!hs
 {-# Language RankNTypes, TypeInType, DataKinds, PolyKinds, TypeOperators,
 GADTs, FlexibleInstances, MultiParamTypeClasses, ConstraintKinds, CPP,
 UndecidableSuperClasses, QuantifiedConstraints, FlexibleContexts #-}

 import Data.Kind

 type Cat ob = ob -> ob -> Type

 data KLEISLI (m :: Type -> Type) :: Cat (KL_kind m) where
   MkKLEISLI :: (a -> m b) -> KLEISLI(m) (KL a) (KL b)

 data KL_kind (m :: Type -> Type) = KL Type

 class    (a ~ KL xx) => AsKL a xx
 instance (a ~ KL xx) => AsKL a xx

 ekki__ :: Monad m => (forall xx. AsKL a xx) => KLEISLI m a a
 ekki__ = MkKLEISLI undefined
 }}}

--

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15625#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list