Skip to content

GHC Panic compiling type family with -XPolyKinds

I received the following error message:

ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.0.20111219 for x86_64-unknown-linux):
        tyConKind ghc-prim:GHC.Prim.BOX{(w) tc 347}

I was compiling the following code:

{-# LANGUAGE TypeFamilies,
             PolyKinds,
             ScopedTypeVariables
 #-}

convert :: a -> b
convert = undefined

type family Foo a

bar :: forall a b. b -> (Foo a)
bar f = (convert f :: (Foo a))

Interestingly, the output is different when changing the order in the forall (forall b a produces a different error). The same result happened on Linux/x86_64 and MacOS 10.7.2/x86_64-apple-darwin,

Trac metadata
Trac field Value
Version 7.4.1-rc1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information