Skip to content

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

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.

Trac metadata
Trac field Value
Version 7.4.1-rc1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information