Skip to content

Rank-n-types without -XRankNTypes

Consider two modules:

{-# LANGUAGE RankNTypes #-}
module X where

foo :: (forall a. a -> a) -> Int
foo = foo
module Y where
import X

g = foo

Note that Y does not use RankNTypes.

Currently, g is accepted. However, the inferred type of g is (forall a. a -> a) -> Int, which cannot be written. We should not allow a value if writing its type requires an additional extension.

Reporting on behalf of Simon PJ.

Edited by Krzysztof Gogolewski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information