Ticket #7328 (closed bug: fixed)

Opened 7 months ago

Last modified 6 months ago

Seemingly inappropriate "expecting one more argument" error in polykinded class

Reported by: illissius Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Difficulty: Unknown
Test Case: polykinds/T7328 Blocked By:
Blocking: Related Tickets:

Description

Triggered by the following code:

{-# LANGUAGE PolyKinds, GADTs #-}

data Proxy a

class Foo a where
    foo :: a ~ f i => Proxy (Foo f)

GHC writes:

test.hs:6:34:
    Expecting one more argument to `f'
    In the type `a ~ f i => Proxy (Foo f)'
    In the class declaration for `Foo'

It seems to me that given Foo :: forall k. k -> Constraint, Proxy :: forall k. k -> *, a :: k, f :: k1 -> k, that Foo in Proxy (Foo f) should be instantiated at k1 -> k, and Proxy at Constraint, and that this should work.

Change History

Changed 7 months ago by illissius

If instead of Proxy (Foo f) I write Proxy (Bar f) or Proxy f, there is no error.

Changed 7 months ago by simonpj@…

commit 8691041c8360aba98d3e1489b7804a5d83dcab70

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Mon Oct 15 15:52:02 2012 +0100

    Improve error reporting for kind occurs-checks
    
    Fixes Trac #7328.

 compiler/typecheck/TcHsType.lhs |   36 +++++++++++++++++-------
 compiler/typecheck/TcUnify.lhs  |   57 +++++++++++++++++++++-----------------
 2 files changed, 56 insertions(+), 37 deletions(-)

Changed 7 months ago by simonpj

  • status changed from new to merge
  • difficulty set to Unknown
  • testcase set to polykinds/T7328

Worth trying to merge... but not if it's hard.

Changed 6 months ago by igloo

  • status changed from merge to closed
  • resolution set to fixed

Several conflicts, so not merging.

Note: See TracTickets for help on using tickets.