Lexically-scoped type variables
Lexically-scoped type variables
复制标题
词法范围的类型变量
DOI:
--
复制
发表时间:
2002
期刊:
影响因子:
--
通讯作者:
Mark Shields
中科院分区:
文献类型:
--
作者:
S. Jones;Mark Shields
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.