Quais são alguns tipos e / ou termos no sistema-f que não podem ser expressos em Hindley Milner
-
14-11-2019 - |
Pergunta
Eu lembro de ler em algum lugar que Hindley Milner era uma restrição ao sistema - f.Se esse é o caso, alguém poderia, por favor, me fornecer alguns termos que podem ser digitados no sistema f, mas não em hm.
Solução
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 em: CC-BY-SA com atribuição
Não afiliado a StackOverflow