Opened 7 years ago

Closed 7 years ago

#7073 closed bug (fixed)

Kind variable problem when declaring associated type family

Reported by: goldfire Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.5
Keywords: PolyKinds TypeFamilies Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: polykinds/T7073
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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

Change History (2)

comment:1 Changed 7 years ago by simonpj@…

commit 3b9be226397535492a08cd4f25d5f672d245385b

Author: Simon Peyton Jones <>
Date:   Sat Jul 14 13:12:13 2012 +0100

    When checking associated type instances, check that
    the *type* indices match those of the class instance.
    We don't need to track tke kind indices, and indeed
    thay don't have the same careful name scoping.
    See the notes in checkValidClass.
    Fixes Trac #7073

 compiler/typecheck/TcTyClsDecls.lhs |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

comment:2 Changed 7 years ago by simonpj

difficulty: Unknown
Resolution: fixed
Status: newclosed
Test Case: polykinds/T7073


Note: See TracTickets for help on using tickets.