Example of type in System F that is not available in Hindley Milner type inference

hawkeye

Under 'What is Hindley Milner' it states:

Hindley-Milner is a restriction of System F, which allows more types but which requires annotations by the programmer.

My question is, What is an example of a type available in System F, that is not available in Hindley Milner (type inference)?

(The assumption being that the inference of System F types has been proven undecideable)

Andreas Rossberg

Hindley/Milner does not support higher-rank polymorphic types, i.e., types where the universal quantifier is nested into some larger type (i.e., any notion of first-class polymorphism).

One of the simplest example would be e.g.:

f : (∀α. α → α) → int × string
f id = (id 4, id "boo")

Inferring higher-rank polymorphism is known to be undecidable in general. Similar limitations apply to recursion: a recursive definition cannot have polymorphic recursive uses. For a contrived example:

g : ∀α. int × α → int
g (n,x) = if n = 0 then 0 else if odd n then g (n-1, 3) else g (n-1, "boo")

This is kind of unsurprising given the above, and the fact that a recursive definition like the above is just a shorthand for applying the higher-order Y combinator at a polymorphic type, which would again require (impredicative) first-class polymorphism.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

在Hindley Milner类型推断中不可用的System F中类型的示例

来自分类Dev

使用Hindley Milner类型推断在SML中类型定义的增长

来自分类Dev

使用Hindley Milner类型推断在SML中类型定义的增长

来自分类Dev

Scala : Does variable type inference affect performance?

来自分类Dev

在Hindley Milner类型系统中,我们可以在构造函数位置使用类型变量吗?

来自分类Dev

在Hindley Milner类型系统中,我们可以在构造函数位置使用类型变量吗?

来自分类Dev

Scala's type inference with Sets behaves... strangely?

来自分类Dev

是否可以在F#类型提供程序中将System.Type用作静态参数?

来自分类Dev

是否可以在F#类型提供程序中将System.Type用作静态参数?

来自分类Dev

Linux find -type f 被忽略

来自分类Dev

No qualifying bean of type 'tn.esen.dao.StudentRepository' available

来自分类Dev

GWT Maven Project fails to compile - No source code is available for type

来自分类Dev

System.Type到XmlSchema内置类型

来自分类Dev

从System.Type获取静态属性的值

来自分类Dev

从System.Type在AppDomain中创建实例

来自分类Dev

“ System.Type”不包含“ GenericTypeArguments”的定义

来自分类Dev

Type of f g x = g . g x

来自分类Dev

LINQ to Entities does not recognize the method 'System.Object Parse(System.Type, System.String)'

来自分类Dev

LINQ to Entities无法识别方法'System.Object Parse(System.Type,System.String)'

来自分类Dev

找不到方法:“ System.Type System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(System.Guid)”

来自分类Dev

MissingMethodException:找不到方法:'System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)'

来自分类Dev

Assert.IsInstanceOfType无法从对象转换为System.Type

来自分类Dev

C#类中的System.Type如何工作?

来自分类Dev

The type or namespace name 'Deployment' does not exist in the namespace 'System.Windows'

来自分类Dev

如何使用反射获取静态成员的System.Type?

来自分类Dev

Android type_system_overlay无法覆盖整个屏幕

来自分类Dev

Could not load type 'System.Web.Mvc.ViewPage'

来自分类Dev

如何为System.Type创建任意数组?

来自分类Dev

无法将System.Type隐式转换为对象

Related 相关文章

  1. 1

    在Hindley Milner类型推断中不可用的System F中类型的示例

  2. 2

    使用Hindley Milner类型推断在SML中类型定义的增长

  3. 3

    使用Hindley Milner类型推断在SML中类型定义的增长

  4. 4

    Scala : Does variable type inference affect performance?

  5. 5

    在Hindley Milner类型系统中,我们可以在构造函数位置使用类型变量吗?

  6. 6

    在Hindley Milner类型系统中,我们可以在构造函数位置使用类型变量吗?

  7. 7

    Scala's type inference with Sets behaves... strangely?

  8. 8

    是否可以在F#类型提供程序中将System.Type用作静态参数?

  9. 9

    是否可以在F#类型提供程序中将System.Type用作静态参数?

  10. 10

    Linux find -type f 被忽略

  11. 11

    No qualifying bean of type 'tn.esen.dao.StudentRepository' available

  12. 12

    GWT Maven Project fails to compile - No source code is available for type

  13. 13

    System.Type到XmlSchema内置类型

  14. 14

    从System.Type获取静态属性的值

  15. 15

    从System.Type在AppDomain中创建实例

  16. 16

    “ System.Type”不包含“ GenericTypeArguments”的定义

  17. 17

    Type of f g x = g . g x

  18. 18

    LINQ to Entities does not recognize the method 'System.Object Parse(System.Type, System.String)'

  19. 19

    LINQ to Entities无法识别方法'System.Object Parse(System.Type,System.String)'

  20. 20

    找不到方法:“ System.Type System.Runtime.InteropServices.Marshal.GetTypeFromCLSID(System.Guid)”

  21. 21

    MissingMethodException:找不到方法:'System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)'

  22. 22

    Assert.IsInstanceOfType无法从对象转换为System.Type

  23. 23

    C#类中的System.Type如何工作?

  24. 24

    The type or namespace name 'Deployment' does not exist in the namespace 'System.Windows'

  25. 25

    如何使用反射获取静态成员的System.Type?

  26. 26

    Android type_system_overlay无法覆盖整个屏幕

  27. 27

    Could not load type 'System.Web.Mvc.ViewPage'

  28. 28

    如何为System.Type创建任意数组?

  29. 29

    无法将System.Type隐式转换为对象

热门标签

归档