Skip to content

Enabling PolyKinds makes some type errors weird

Consider this program:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}

module Existential where

data Any (f :: k -> *)

data X a
data Y (a :: *)
data Z (a :: Bool)

x :: Any X -> ()
x 'c' = ()

y :: Any Y -> ()
y 'c' = ()

z :: Any Z -> ()
z 'c' = ()

x, y and z are all ill-typed, but the shapes of the type errors are different in each case. They are respectively:

    Couldn't match expected type `Any k (X k)' with actual type `Char'
    Couldn't match expected type `Any * Y' with actual type `Char'
    Couldn't match expected type `Any Bool Z' with actual type `Char'

Aren't they supposed to say just 'Any X', 'Any Y' and 'Any Z'?

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