Skip to content

Panic "lookupVarEnv_NF" when using a functional dependency with a kind variable

The following code causes a panic:

{-# LANGUAGE PolyKinds, DataKinds, MultiParamTypeClasses,
             FunctionalDependencies
 #-}

class Foo a (b :: k) | a -> k
instance Foo Bool False

The error is

ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 7.7.20120807 for x86_64-apple-darwin):
	lookupVarEnv_NF: Nothing

In previous versions of GHC 7.5.x, a functional dependency of this nature worked just fine and had the expected behavior of fixing the value of k once a was known. It's unclear to me whether this should compile or not, but it shouldn't cause a panic. I believe that my code that used the functional dependency could use a -> b in place of a -> k with no ill effect, so turning this into an error is not a problem.

Trac metadata
Trac field Value
Version 7.5
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