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

GADT符合亚型

GADTs meet subtyping

Gabriel Scherer, Didier Rémy

摘要:

虽然广义代数数据库(\GADTs)现在被认为是很好理解的,但将它们添加到具有子类型概念的语言中会带来一些惊喜。\GADT参数协变意味着什么?答案是相当微妙的。它涉及到子类型关系的细粒度属性,这些属性引起了有趣的设计问题。我们允许方差注释在\GADT定义,研究其合理性,并提出了一个声音和完整的算法来检查它们。我们的工作可以应用于现实世界的ML类语言,如OCaml显式子类型,或一般的子类型约束的语言。

英文摘要:

While generalized algebraic datatypes (\GADTs) are now considered well-understood, adding them to a language with a notion of subtyping comes with a few surprises. What does it mean for a \GADT parameter to be covariant? The answer turns out to be quite subtle. It involves fine-grained properties of the subtyping relation that raise interesting design questions. We allow variance annotations in \GADT definitions, study their soundness, and present a sound and complete algorithm to check them. Our work may be applied to real-world ML-like languages with explicit subtyping such as OCaml, or to languages with general subtyping constraints.

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

↑