Ticket #5769 (closed bug: fixed)

Opened 17 months ago

Last modified 16 months ago

Incorrect 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 trying to compile

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

convert :: a -> b
convert = undefined

type family Foo a

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

I get the following error message:

Sandbox.hs:12:10:
    Couldn't match type `Foo k a' with `Foo * b'
    NB: `Foo' is a type function, and may not be injective
    In the expression: (convert f :: Foo a)
    In an equation for `bar': bar f = (convert f :: Foo a)

However, this compiles just fine without PolyKinds.

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.