Skip to content

Unbound kind variable can appear in RHS of associated type

Consider the following code:

{-# LANGUAGE TypeFamilies, PolyKinds, MultiParamTypeClasses,
             FlexibleInstances, DataKinds #-}

data KProxy (a :: *) = KP

class Foo (a :: k1) (b :: k2) where
  type Bar a

instance Foo (a :: k1) (b :: k2) where
  type Bar a = (KP :: KProxy k2)

The kind variable k2 appears on the RHS of the instance for Bar but not on the left-hand side. This is disallowed for type variables, but there seems to be no check for kind variables.

I will fix in an upcoming patch.

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