#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 Difficulty: Unknown
Test Case: indexed_types/should_compile/T7282 Blocked By:
Blocking: Related Tickets:

Description

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

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

fails with:

I:\a.hs:7:5:
    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 15 months ago by simonpj@…

commit d79c0c48bb64f85ab45adcc3158be9f71845f974

Author: Simon Peyton Jones <simonpj@microsoft.com>
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 15 months ago by simonpj

  • Difficulty set to Unknown
  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to indexed_types/should_compile/T7282

Thank you for reporting this -- v helpful.

Simon

Note: See TracTickets for help on using tickets.