GADT符合分型
GADT meet Subtyping
摘要:
虽然广义抽象数据库(GADT)现在被认为是很好理解的,但将它们添加到具有子类型概念的语言中会带来一些惊喜。GADT参数协变意味着什么?答案是相当微妙的。它涉及到子类型关系的细粒度属性,这些属性引起了有趣的设计问题。我们允许在GADT定义的方差注释,研究其合理性,并提出了一个健全的和完整的算法来检查它们。我们的工作可以应用于现实世界的ML类语言,如OCaml显式子类型,或一般的子类型约束的语言。
英文摘要:
While generalized abstract datatypes (GADT) 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分析而来,可能存在错误,请以论文正文为准。