Skip to content

Given kind equalities are discarded

The following program:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}

module Bug where

data U (s :: *) = forall k. AA k [U s]

data I (u :: U *) (r :: [*]) :: * where
  A :: I (AA t as) r

-- fs unused, but needs to be present for the bug
class C (u :: U *) (r :: [*]) (fs :: [*]) where
  c :: I u r -> I u r

instance (C (AA (t (I a ps)) as) ps fs) => C (AA t (a ': as)) ps fs where
  c A = c undefined

crashes a fresh copy of GHC HEAD with the following:

ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 7.7.20131126 for i386-unknown-linux):
        kindFunResult k1{tv a24f} [ssk]
Trac metadata
Trac field Value
Version 7.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information