系统-f中的某些类型和/或术语在Hindley Milner中不能表达
-
14-11-2019 - |
题
我记得在某个地方阅读Hindley Milner对系统-F的限制。如果是这种情况,请有人可以向我提供可以在System-F中键入但不在HM中的一些术语。
解决方案
Anything involving higher-ranked (i.e. "first-class") polymorphism. For example:
lambda f : (forall A. A -> A). (f Int 1, f String "hello")
This function would have the type (forall A. A -> A) -> Int * String
, which is not expressible in HM, where all polymorphic type schemes must be in "prenex" form (i.e. the quantifier may only occur on the outside, never nested).
不隶属于 StackOverflow