Opened 4 years ago

Closed 4 years ago

#6039 closed bug (fixed)

Ill-sorted kinds crash GHC

Reported by: simonpj Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: polykinds/T6039
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


GHC's sort-checker for kinds is not being terribly clever

{-# LANGUAGE PolyKinds, KindSignatures #-}
module Foo where

data T (a :: j k) = MkT

crashes the HEAD with

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

Change History (2)

comment:1 Changed 4 years ago by simonpj@…

commit a40ee020b53d3b397d24f4addeda78945e72292a

Author: Simon Peyton Jones <>
Date:   Wed Apr 25 09:37:53 2012 +0100

    Better error messages during sort checking of kind signatures
    Fixes Trac #6039, where we have a bogus kind signature
       data T (a :: j k) = MkT

 compiler/typecheck/TcHsType.lhs     |   63 ++++++++++++++++++----------------
 compiler/typecheck/TcTyClsDecls.lhs |    2 +
 2 files changed, 35 insertions(+), 30 deletions(-)

comment:2 Changed 4 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to polykinds/T6039

Better message

    Kind variable `j' cannot appear in a function position
    In the kind `j k'
    In the data declaration for `T'
Note: See TracTickets for help on using tickets.