Impredicativity behavior in `:k` command in GHCi
In GHCi, the following command works:
Prelude> :set -XRankNTypes
Prelude> :k (Maybe (forall a. a -> a))
(Maybe (forall a. a -> a)) :: *
Note here the type argument of Maybe
is a polymorphic type.
However the following would be (correctly) rejected:
Prelude> let f :: (Maybe (forall a. a -> a)) -> Int; f _ = 1
<interactive>:4:10: error:
• Illegal polymorphic type: forall a. a -> a
GHC doesn't yet support impredicative polymorphism
• In the type signature: f :: (Maybe (forall a. a -> a)) -> Int
Question: why does :k
behave differently and is it what is expected?
I think if we have #14859 (closed) those are both acceptable though?
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |