Ticket #5770 (closed bug: fixed)

Opened 17 months ago

Last modified 16 months ago

Non-sensical error message when compiling with PolyKinds and a type family

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

Description

When I compile the following code:

{-# LANGUAGE TypeFamilies,
             PolyKinds,
             ScopedTypeVariables
 #-}

convert :: a -> b
convert = undefined

type family Foo a 
type instance Foo Int = Bool

bar :: forall a b c dummya. (b -> c) -> ((Foo a) -> c)
bar f = (convert f :: (Foo a) -> c)

I get the following error message:

Sandbox.hs:13:34:
    Kind mis-match
    Expected kind `OpenKind', but `c' has kind `b'
    In an expression type signature: (Foo a) -> c
    In the expression: (convert f :: (Foo a) -> c)
    In an equation for `bar': bar f = (convert f :: (Foo a) -> c)

This error message does not make sense, for 'b' isn't a kind. It is interesting to note that removing dummya from the list of declared type variables changes the error to a GHC panic.

Change History

Changed 17 months ago by goldfire

  • failure changed from None/Unknown to GHC rejects valid program

Changed 17 months ago by igloo

  • owner set to dreixel
  • difficulty set to Unknown
  • priority changed from normal to high
  • milestone set to 7.4.1

Thanks for the report. dreixel, if this is easy to fix we may as well get it into 7.4.1, although it's not actually a regression as PolyKinds?? is new.

Changed 17 months ago by dreixel

  • related set to #5717

Changed 17 months ago by igloo

  • milestone changed from 7.4.1 to 7.4.2

Changed 16 months ago by simonpj

  • milestone changed from 7.4.2 to 7.6.1

Moving to 7.6.1; PolyKinds is not advertised as working in 7.4, and merging fixes will be too destablising.

Changed 16 months ago by simonpj

  • status changed from new to closed
  • testcase set to polykinds/T5770
  • resolution set to fixed

Fixed by the massive polykinds patch

commit 3bf54e78cfd4b94756e3f21c00ae187f80c3341d
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Fri Mar 2 16:32:58 2012 +0000

    Hurrah!  This major commit adds support for scoped kind variables,
    which (finally) fills out the functionality of polymorphic kinds.
    It also fixes numerous bugs.
Note: See TracTickets for help on using tickets.