Skip to content

forall on non-* types

See main ticket #22063

This code

{-# LANGUAGE RankNTypes, ImpredicativeTypes #-}
x = Nothing :: (forall a. Maybe) Int

gives

    Couldn't match type `Maybe' with `forall a. Maybe'
    Expected type: forall a. Maybe Int
      Actual type: Maybe Int

which does not seem correct. There are two options:

Option A: We allow this.

Option B: We reject this as ill-kinded and allow forall a. T only when T has kind *. I prefer this option; in theory this can break existing code, but I am not aware of any code that uses forall on non-* type (please correct me if I'm wrong), and e.g. this means forall a. a inhabits every kind, for example Bool.

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