Opened 7 years ago

Closed 7 years ago

#7006 closed bug (fixed)

Panic when promoted GADT arguments cross module boundaries

Reported by: anders_ Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.4.1
Keywords: DataKinds Cc: andy@…
Operating System: MacOS X Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


This seems to only happen when the importing module is compiled in a separate invocation of GHC from the module containing the GADT. That is, it happens with ghc -c-ing the two separately, or with --make, when only the importing module has been changed since last time. Cleaning between each compile seems to be a workaround, but that’s a massive pain. :)

Sample code & GHC's reaction:

{-# LANGUAGE KindSignatures, TypeOperators, DataKinds, GADTs #-}
module A where

data List (xs :: [*]) where
  N    :: List '[]
  (:>) :: x -> List xs -> List (x ': xs)
{-# LANGUAGE GADTs, TypeOperators #-}
module B where
import A

foo :: List (x ': xs) -> x
foo (x :> _) = x
$ ghc -c A.hs
$ ghc -c B.hs
ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.1 for x86_64-apple-darwin):
	tyThingTyCon Data constructor `ghc-prim:GHC.Types.:{(w) d 64}'

Please report this as a GHC bug:

(As an aside, it’s kind of annoying that TypeOperators isn’t automatically implied by DataKinds, but that’s not important really.)

Attachments (2)

A.hs (169 bytes) - added by anders_ 7 years ago.
B.hs (108 bytes) - added by anders_ 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by anders_

Attachment: A.hs added


Changed 7 years ago by anders_

Attachment: B.hs added

comment:1 Changed 7 years ago by simonpj

difficulty: Unknown
Resolution: fixed
Status: newclosed

Thanks. I think this is the same as #6011 and #6025, but your example is fine in HEAD. We won't fix it in 7.4, because kind polymorphism is not an advertised feature of 7.4.


Note: See TracTickets for help on using tickets.