¿Cuáles son algunos tipos y / o términos en el sistema-F que no se pueden expresar en Hindley Milner?
-
14-11-2019 - |
Pregunta
Recuerdo haber leído en algún lugar que Hindley Milner era una restricción en el sistema-F.Si ese es el caso, podría alguien, por favor, proporcione algunos términos que se pueden escribir en System-F pero no en Hm.
Solución
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).
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow