arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2004.00396cs.PL
收藏

FreezeML:一级多态性的完备而简单的类型推断

FreezeML: Complete and Easy Type Inference for First-Class Polymorphism

Frank Emrich, Sam Lindley, Jan Stolarek, James Cheney, Jonathan Coates

摘要:

ML在提供静态类型的多态性方面非常出色,而程序员不必编写任何类型注释。这种简约的代价是程序员被限制在一种多态形式中,在这种多态形式中,量词只能出现在类型的最外层,类型变量只能用单态类型实例化。非限制性System F样式多态的类型推断一般是不可判定的。尽管如此,文献中仍然有大量的建议来弥合ML和System F之间的差距。我们提出了一个新的建议,FreezeML,这是ML的保守扩展,具有两个新功能。第一,let-binders和binder-binders可以用任意的System F类型进行注释。其次,变量的出现可能会被冻结,显式地禁用实例化。FreezeML配备了在系统F之间来回的类型保持翻译,并允许类型推断算法,算法W的扩展,它是可靠的和完整的,并产生主类型。

英文摘要:

ML is remarkable in providing statically typed polymorphism without the programmer ever having to write any type annotations. The cost of this parsimony is that the programmer is limited to a form of polymorphism in which quantifiers can occur only at the outermost level of a type and type variables can be instantiated only with monomorphic types. Type inference for unrestricted System F-style polymorphism is undecidable in general. Nevertheless, the literature abounds with a range of proposals to bridge the gap between ML and System F. We put forth a new proposal, FreezeML, a conservative extension of ML with two new features. First, let- and lambda-binders may be annotated with arbitrary System F types. Second, variable occurrences may be frozen, explicitly disabling instantiation. FreezeML is equipped with type-preserving translations back and forth between System F and admits a type inference algorithm, an extension of algorithm W, that is sound and complete and which yields principal types.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑