Skip to content

panic with GADT etc.

The following code causes a panic with GHC installed from ghc-6.9.20071218-i386-unknown-linux.tar.bz2:

{-# LANGUAGE FlexibleContexts, FlexibleInstances, GADTs #-}
module Bug where

    class C a where
        f :: G a -> ()

    instance (C ()) => C (b c) where
        f (G x) = f x where

    data G a where
        G  :: G () -> G (b c)

The output of ghci is:

GHCi, version 6.9.20071218: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
ghc-6.9.20071218: panic! (the 'impossible' happened)
  (GHC version 6.9.20071218 for i386-unknown-linux):
        Coercion.splitCoercionKindOf
    base:GHC.Prim.left{(w) tc 34B} $co${tc aog} [tv]
    <pred>b{tv anB} [sk] ~ b{tv aoc} [sk]

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

The output of ghc -c is:

ghc-6.9.20071218: panic! (the 'impossible' happened)
  (GHC version 6.9.20071218 for i386-unknown-linux):
        Coercion.splitCoercionKindOf
    base:GHC.Prim.left{(w) tc 34B} $co${tc a6t} [tv]
    <pred>b{tv a5O} [sk] ~ b{tv a6p} [sk]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information