Skip to content

Kind variables not allowed in class instance declarations

Consider the following code:

{-# LANGUAGE KindSignatures, PolyKinds, DataKinds, RankNTypes #-}

data KProxy (a :: *) = KP

class KindClass (kp :: KProxy k)
instance KindClass (KP :: KProxy [k])

The last line fails to compile, producing the following error message:

  Not in scope: type variable `k'

However, there is a workaround. When I change the last line to

instance forall (a :: k). KindClass (KP :: KProxy [k])

all is good. Unfortunately, this last line requires the declaration of an unused type variable a, which is a little messy.

This was tested on 7.5.20120426.

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