Ticket #7053 (closed bug: fixed)

Opened 11 months ago

Last modified 10 months ago

Panic with PolyKinds + GADTs

Reported by: dreixel Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.5
Keywords: PolyKinds Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: polykinds/T7053, T7053a Blocked By:
Blocking: Related Tickets:

Description

This works:

data TypeRep (a :: k) :: * where
  TyApp   :: TypeRep a -> TypeRep b -> TypeRep (a b)

Whereas this (removing the obvious return kind of the datatype):

data TypeRep (a :: k) where
  TyApp   :: TypeRep a -> TypeRep b -> TypeRep (a b)

Gives this panic:

ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 7.5 for i386-unknown-linux):
        metaTvRef
<<details unavailable>>

(The example is pretty much taken from Weirich, Hsu, and Eisenberg, but I haven't seen it reported here yet.)

Change History

Changed 10 months ago by simonpj

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to fixed
  • testcase set to polykinds/T7053, T7053a

Great. With HEAD it now gives

T7053.hs:6:52:
    Expecting one more argument to `b'
    In the type `TypeRep (a b)'
    In the definition of data constructor `TyApp'
    In the data declaration for `TypeRep'

which is right because there isn't a "complete kind signature". See Section 7.8.3 of the user manual http://www.haskell.org/ghc/dist/current/docs/html/users_guide/kind-polymorphism.html#id9430056

If you give a "complete kind signature", it compiles fine:

data TypeRep (a :: k) :: * where
   TyApp   :: TypeRep a -> TypeRep b -> TypeRep (a b)

The precise specification of what it means to have a "complete kind signature" is up for debate. Currently it is signalled by that "::" I added.

Simon

Note: See TracTickets for help on using tickets.