Skip to content

"deriving (Functor)" on a polykinded type produces ill-kinded instance

Arose in #10524 (closed), and new since 7.10.

rwbarton@morphism:/tmp$ ~/ghc/inplace/bin/ghc-stage2 --interactive
GHCi, version 7.11.20150615: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XPolyKinds -XDeriveFunctor -ddump-deriv -fprint-explicit-kinds
Prelude> newtype Compose f g a = Compose (f (g a)) deriving Functor

==================== Derived instances ====================
Derived instances:
  instance forall (k_and :: BOX)
                  (f_ane :: k_and -> *)
                  (g_anf :: * -> k_and).
           (GHC.Base.Functor f_ane, GHC.Base.Functor g_anf) =>
           GHC.Base.Functor (Ghci1.Compose k_and * f_ane g_anf) where
    GHC.Base.fmap f_ang (Ghci1.Compose a1_anh)
      = Ghci1.Compose (GHC.Base.fmap (GHC.Base.fmap f_ang) a1_anh)
  

Generic representation:
  
  Generated datatypes for meta-information:
  
  Representation types:


Prelude> :i GHC.Base.Functor
class Functor (f :: * -> *) where
[...]

The context (GHC.Base.Functor f_ane, GHC.Base.Functor g_anf) is ill-kinded except when k_and = *.

Trac metadata
Trac field Value
Version 7.11
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