Opened 5 years ago

Closed 5 years ago

#7282 closed bug (fixed)

polykinds error: Found `k' but expected `k'

Reported by: HolgerReinhardt Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case: indexed_types/should_compile/T7282
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


{-# OPTIONS -XTypeFamilies -XDataKinds -XPolyKinds #-}

class Foo (xs :: [k]) where 
    type Bar xs :: *
instance Foo '[] where
    type Bar '[] = Int

fails with:

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

If I change the kind of xs from [k] to [*], the program is accepted.

Change History (2)

comment:1 Changed 5 years ago by simonpj@…

commit d79c0c48bb64f85ab45adcc3158be9f71845f974

Author: Simon Peyton Jones <>
Date:   Tue Jan 29 08:43:02 2013 +0000

    Improve consistency checking for associated type-family instances
    The "consistency" in this case is beteween the instance head
    and the associated type instance head, which is made trickier
    by the presence of kind variables that are not explicitly mentioned
    in the class head.
    See Note [Checking consistent instantiation] in TcInstDcls
    This fixes Trac #7282.

 compiler/typecheck/TcInstDcls.lhs   |  239 ++++++++++++++++++++++-------------
 compiler/typecheck/TcTyClsDecls.lhs |   37 ------
 2 files changed, 154 insertions(+), 122 deletions(-)

comment:2 Changed 5 years ago by simonpj

difficulty: Unknown
Resolution: fixed
Status: newclosed
Test Case: indexed_types/should_compile/T7282

Thank you for reporting this -- v helpful.


Note: See TracTickets for help on using tickets.