Skip to content

Possible error message improvement when -XRankNTypes is missing

I'm forwarding wishlist bug #499217 from Debian's BTS.


If I ask ghc to interpret a higher-rank function type, I get this error:

Prelude> :t undefined :: ((forall a . a -> a) -> a -> a)

<interactive>:1:24:
    Illegal operator `.' in type `forall a . (a -> a)'
      (Use -XTypeOperators to allow operators in types)

If I turn on -XExistentialQuantification, I get this one instead:

Prelude> :t undefined :: ((forall a . a -> a) -> a -> a)

<interactive>:1:0:
    Illegal polymorphic or qualified type: forall a. a -> a
    In an expression type signature:
      (forall a. a -> a) -> a -> a

It might not be possible in the first case (where forall isn't a keyword), but in the second case it would be nice if ghc could detect my attempt to enter a higher-rank type and suggest the appropriate extension. (-XRankNTypes)

Trac metadata
Trac field Value
Version 6.8.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information