Opened 6 years ago

Closed 6 years ago

#6054 closed bug (fixed)

Couldn't match kind `BOX' against `*' when using SOURCE import

Reported by: atnnn Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: polykinds/T6054
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When this module has a (useless) SOURCE import, using its typeclass gives an error.

module Bar where
import {-# SOURCE #-} Foo
class Bar a (p :: Bool) | a -> p
data Proxy a = Proxy

With the interpreter, the error appears when using the class:

Prelude> :l Bar
*Bar> :set -XFlexibleContexts -XDataKinds
*Bar> Proxy :: Bar '() a => Proxy a
    Couldn't match kind `BOX' against `*'
    Kind incompatibility when matching types:
      k0 :: BOX
      Bool :: *

When compiling, the error appears the *second* run.

$ ghc Main.hs
No instance for (Bar () '() a0)
$ ghc Main.hs
Couldn't match kind `BOX' against `*'

Tested with 7.4.1 and HEAD

Attachments (1) (1.1 KB) - added by atnnn 6 years ago.

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by atnnn

Attachment: added

comment:1 Changed 6 years ago by simonpj@…

commit e57c8667363a60164b3505f22ddd25a9d5be32f5

Author: Simon Peyton Jones <>
Date:   Mon Apr 30 13:40:23 2012 +0100

    Make the interface-file deserialisation work right for promoted types (Trac #6054)
    GHC currently uses the slightly-dodgy plan that when we proote
    a TyCon to be a Kind constructor we leave it with the same Name.
    That means that to make sense of a IfaceType we need to know wheter
    it is really an IfaceType or an IfaceKind, because in the latter an
    occurrence of (say) Maybe will be the *promoted* Maybe.
    See Note [Checking IfaceTypes vs IfaceKinds] in TcIface

 compiler/iface/TcIface.lhs |   73 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 66 insertions(+), 7 deletions(-)

comment:2 Changed 6 years ago by simonpj

difficulty: Unknown
Resolution: fixed
Status: newclosed
Test Case: polykinds/T6054

Thanks for identifying this!

Note: See TracTickets for help on using tickets.