Skip to content

Confusing error message with PolyKinds

Consider the following example code:

import Control.Arrow

foo :: a b (m b)
foo = arr return

if we typecheck this we rightly get two errors about missing instances (Arrow a, Monad m). However, if we enable PolyKinds we get the following error message:

T.hs:4:7:
    Kind incompatibility when matching types:
      a0 :: * -> * -> *
      a :: k1 -> k -> *
    Expected type: a b (m b)
      Actual type: a0 b0 (m0 b0)
    Relevant bindings include foo :: a b (m b) (bound at T.hs:4:1)
    In the expression: arr return
    In an equation for ‘foo’: foo = arr return

I can sort of see where this is coming from if I think really hard :), so perhaps it's not a bug per se, but it's definitely confusing; and it's a pity that a type error (forgotten type qualifier) is reported as a kind error.

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