#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 Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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:  http://www.haskell.org/ghc/reportabug

(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_ 22 months ago.
A.hs
B.hs (108 bytes) - added by anders_ 22 months ago.

Download all attachments as: .zip

Change History (3)

Changed 22 months ago by anders_

A.hs

Changed 22 months ago by anders_

comment:1 Changed 22 months ago by simonpj

  • Difficulty set to Unknown
  • Resolution set to fixed
  • Status changed from new to closed

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.

Simon

Note: See TracTickets for help on using tickets.