Skip to content

Kind variable problem when declaring associated type family

The following code fails to compile:

{-# LANGUAGE PolyKinds, TypeFamilies #-}

class Foo a where
  type Bar a
  type Bar a = Int

The error I get is

    Type indexes must match class instance head
    Found `k' but expected `k'
    In the type synonym instance default declaration for `Bar'
    In the class declaration for `Foo'

When I remove -XPolyKinds, the code compiles without a hiccup.

This was tested on 7.5.2012.0710

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
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information