在 Haskell 我不能写
f :: [forall a. a -> a]
f = [id]
因为
• Illegal polymorphic type: forall a. a -> a
GHC doesn't yet support impredicative polymorphism
但我可以快乐地做
f :: (forall a. a -> a) -> (a, b) -> (a, b)
f i (x, y) = (i x, i y)
因此,正如我所见,GHC 确实支持与上面的错误消息相矛盾的暗示性多态性。为什么(->)
在这种情况下要对类型构造函数进行特殊处理?是什么阻止了 GHC 将此功能推广到所有数据类型?