Ticket #5772 (closed bug: invalid)

Opened 5 months ago

Last modified 5 months ago

Failed kind inference in class declaration (regression error)

Reported by: goldfire Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.4.1-rc1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Consider the following code:

{-# LANGUAGE MultiParamTypeClasses
 #-}

class Foo a b

class Foo a b => Bar a b where
    baz :: a b

This compiles fine in 7.2.1 but fails in 7.4.1-rc1, with the following error:

Sandbox.hs:7:12:
    `a' is applied to too many type arguments
    In the type `a b'
    In the class declaration for `Bar'

Change History

Changed 5 months ago by dreixel

  • status changed from new to closed
  • resolution set to invalid

This is not really a regression; 7.2 was too liberal. The Haskell report specifies that unconstrained type variables should default to kind *. So Foo now correctly gets the kind * -> * -> Constraint, which means you cannot later use a with kind * -> *. If you know that a should have kind * -> *, then you should declare Foo as:

class Foo (a :: * -> *) b
Note: See TracTickets for help on using tickets.