Skip to content

GHC Panic with levity polymorphism

Summary

This program

{-# Language DataKinds                #-}
{-# Language PolyKinds                #-}
{-# Language RankNTypes               #-}
{-# Language StandaloneKindSignatures #-}
{-# Language TypeApplications         #-}

import GHC.Types (Constraint, Type, TYPE, RuntimeRep(..))

type Cat :: forall (rep :: RuntimeRep). TYPE rep -> Type
type Cat ob = ob -> ob -> Type

type  Category' :: forall rep (ob :: TYPE rep). Cat @rep ob -> Constraint
class Category' (cat :: Cat @rep ob) where
 id' :: forall a. cat a a

works if you comment out id' but it currently crashes

$ ghci -ignore-dot-ghci 2849bug.hs
GHCi, version 8.10.0.20191123: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( 2849bug.hs, interpreted )

2849bug.hs:14:23: error:ghc: panic! (the 'impossible' happened)
  (GHC version 8.10.0.20191123:
	No skolem info:
  [rep_aAV]
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1179:37 in ghc:Outputable
        pprPanic, called at compiler/typecheck/TcErrors.hs:2788:5 in ghc:TcErrors

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

>

Steps to reproduce

Run with ghci -ignore-dot-ghci 2849bug.hs.

Environment

  • GHC version used: 8.10.0.20191123
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information