Lexically-scoped type variables

Lexically-scoped type variables
复制标题

词法范围的类型变量

DOI:
--
复制
发表时间:
2002
期刊:
影响因子:
--
通讯作者:
Mark Shields
Mark Shields
中科院分区:
--
文献类型:
--
作者:
S. Jones;Mark Shields

文献摘要

被引文献

相似文献

随着类型推理系统变得越来越复杂,允许程序员给出类型注释变得越来越重要,这些类型注释既记录程序又指导类型推理。在Haskell 98中,不可能编写某些类型注释,因为它们必须提到“范围内”的类型,而语言没有提供命名此类类型的方法。显而易见的解决方案是为词法作用域的类型变量提供语言支持,这是一个尚未系统探索的设计空间。我们的贡献是以连贯的形式将相关的民间传说汇集在一起,并使其比迄今为止更大的社区更容易获得。特别是,我们描述和对比两个主要的替代设计-“类型lambda”的方法SML 97,和一个替代的“类型共享”的方法,这是由GHC和OCaml -和调查一些替代的设计选择。作用域类型变量将在未来的类型系统中发挥关键作用;它们不再是作为事后的想法添加到语言实现中。
As type inference systems become more sophisticated, it becomes increasingly important to allow the programmer to give type annotations that both document the program and guide type inference. In Haskell 98, it is not possible to write certain type annotations, because they must mention a type that is “in scope” and the language provides no way to name such types. The obvious solution is to provide language support for lexicallyscoped type variables, an area whose design space has not been systematically explored. Our contribution is to bring together the relevant folk lore, in coherent form, and make it accessible to a much larger community than hitherto. In particular, we describe and contrast two main alternative designs — the “type-lambda” approach of SML 97, and an alternative “type-sharing” approach which is used by GHC and OCaml — and survey some alternative design choices. Scoped type variables will play a key role in the type systems of the future; they can no longer be added as an afterthought to language implementations.