Skip to content

Core Lint error in Specialise with PolyKinds and derived instance

The following causes a lint error when compiled with -O (but not with -O0):

{-# LANGUAGE PolyKinds #-}
{-# OPTIONS_GHC -dcore-lint -O #-}

data T a b = MkT (a b)
  deriving Show

main = print (MkT (Just True))

For reference, the beginning of the (rather long) error message is:

*** Core Lint errors : in result of Specialise ***
<no location info>: Warning:
    In the type ‛Main.T k_XlN Data.Maybe.Maybe GHC.Types.Bool’
    Kind application error in
      type ‛Main.T k_XlN Data.Maybe.Maybe GHC.Types.Bool’
      Function kind = forall (k_alL :: BOX). (k_alL -> *) -> k_alL -> *
      Arg kinds = [(k_XlN, BOX), (Data.Maybe.Maybe, * -> *),
                   (GHC.Types.Bool, *)]

It looks like something is wrong with the types of the derived Show instance, when PolyKinds is enabled. A similar problem applies to Eq (and perhaps other classes).

Trac metadata
Trac field Value
Version 7.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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