Skip to content

Dependent quantification, GHC panic

While exploring Ryan's gist for term-level f :: forall a -> a -> Type.

{-# Language PolyKinds          #-}
{-# Language TypeApplications   #-}
{-# Language ImpredicativeTypes #-}

import Data.Kind

data A k :: k -> Type

f :: KindOf A
f a = undefined

type KindOf (a :: k) = k

a = f @Int

gives

$ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci 630_bug.hs
GHCi, version 8.7.20181029: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( 630_bug.hs, interpreted )
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.7.20181029 for x86_64-unknown-linux):
        ASSERT failed!
  KindOf A
  forall k -> k -> *
  k_a1xQ[sk:0]
  k_a1xQ[sk:0] -> *
  k_a1xQ[sk:0]
  [req]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
        pprPanic, called at compiler/utils/Outputable.hs:1219:5 in ghc:Outputable
        assertPprPanic, called at compiler/typecheck/TcExpr.hs:1336:94 in ghc:TcExpr

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

>
Trac metadata
Trac field Value
Version 8.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information