[GHC] #11520: GHC falls into a hole if given incorrect kind signature

GHC ghc-devs at haskell.org
Sun Jan 31 13:07:09 UTC 2016


#11520: GHC falls into a hole if given incorrect kind signature
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by bgamari:

@@ -12,6 +12,1 @@
- data TypeRep (a :: k) where
-     TypeCon :: forall (a :: k). String -> TypeRep k -> TypeRep a
-     TypeApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1).
-                TypeRep a
-             -> TypeRep b
-             -> TypeRep (a b)
+ data TypeRep (a :: k)
@@ -28,1 +23,0 @@
-

New description:

 If one provides an incorrect kind signature GHC throws up. For instance,
 this non-sense,

 {{{#!hs
 {-# LANGUAGE RankNTypes, PolyKinds, TypeInType, GADTs,
 UndecidableSuperClasses #-}

 module Play where

 import GHC.Types hiding (TyCon)

 data TypeRep (a :: k)

 class Typeable k => Typeable (a :: k) where
     typeRep :: TypeRep a

 data Compose (f :: k1 -> *) (g :: k2 -> k1) (a :: k2) = Compose (f (g a))

 -- Note how the kind signature on g is incorrect
 instance (Typeable f, Typeable (g :: k), Typeable k) => Typeable (Compose
 f g) where
     typeRep = undefined
 }}}
 fails with
 {{{
 λ> :load Bug.hs
 [1 of 1] Compiling Play             ( Bug.hs, interpreted )
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.1.20160122 for x86_64-unknown-linux):
         fvProv falls into a hole {abet}

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

 }}}

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11520#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list