Skip to content

Error message mentions impredicative polymorphism

When we apply Lens to too many arguments in the :kind command we get a sensible error message

ghci> type Lens s a = forall f. Functor f => (a -> f a) -> (s -> f s)
ghci> :kind Lens _ _
Lens _ _ :: *
ghci> :kind Lens _ _ _

<interactive>:1:1: error:
    • Expecting one fewer argument to ‘Lens t0 t1’
      Expected kind ‘k0 -> k1’, but ‘Lens t0 t1’ has kind ‘*’
    • In the type ‘Lens _ _ _’

but use the same in a type signature or annotation and it complains about impredicative polymorphism

ghci> :t undefined :: Lens _ _ _

<interactive>:1:1: error:
    • Illegal polymorphic type: Lens _ _1
      GHC doesn't yet support impredicative polymorphism
    • In the expression: undefined :: Lens _ _ _
ghci> a :: Lens _ _ _; a = undefined

<interactive>:6:1: error:
    Illegal polymorphic type: Lens _ _1
    GHC doesn't yet support impredicative polymorphism
Trac metadata
Trac field Value
Version 7.10.3
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