Skip to content

panic compiling associated type synonyms

Trying to compile this:

{-# OPTIONS -fglasgow-exts #-}
data Cons a b
data Nil
data Foo a = Foo 
class (Appendt l0 l1 ~ l2) => Append l0 l1 l2 where
    type Appendt l0 l1 :: *
    append :: Foo l0 -> Foo l1 -> Foo l2
instance (Appendt b l1 ~ l2) => Append (Cons a b) l1 (Cons c l2) where
    type Appendt (Cons a b) l1 = Cons a (Appendt b l1)

gives this error:

ghc-6.8.1: panic! (the 'impossible' happened)
  (GHC version 6.8.1 for i386-unknown-linux):
        Coercion.splitCoercionKindOf
    base:GHC.Prim.trans{(w) tc 34y}
      (base:GHC.Prim.sym{(w) tc 34v}
         ((main:Main.:CoF:R1Appendt{tc roB})
            a{tv aph} [sk] b{tv ape} [sk] l1{tv apf} [sk]))
      t_apM{tv} [tau]
    <pred>(main:Main.:R1Appendt{tc ros})
            a{tv aph} [sk] b{tv ape} [sk] l1{tv apf} [sk]
            ~
          t_apM{tv} [tau]

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

i've tried to reduce the code to the minimum that will trigger the panic.

Trac metadata
Trac field Value
Version 6.8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC sanzhiyan@gmail.com
Operating system Unknown
Architecture Unknown
Edited by Ian Lynagh -
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information