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

GADT和穷举:寻找不可能

GADTs and Exhaustiveness: Looking for the Impossible

Jacques Garrigue, Jacques Le Normand

摘要:

模式匹配的可靠穷举检查是函数式程序设计语言的一个基本特性,OCaml支持GADT。然而,这种检查是不完整的,因为它可能无法检测到一个模式可以匹配没有具体的值。在本文中,我们表明,这个问题实际上是不可判定的,但我们可以加强穷举和冗余检查,使他们涵盖更多的实际情况。新算法依赖于对模式的类型推断的巧妙修改。

英文摘要:

Sound exhaustiveness checking of pattern-matching is an essential feature of functional programming languages, and OCaml supports it for GADTs. However this check is incomplete, in that it may fail to detect that a pattern can match no concrete value. In this paper we show that this problem is actually undecidable, but that we can strengthen the exhaustiveness and redundancy checks so that they cover more practical cases. The new algorithm relies on a clever modification of type inference for patterns.

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

↑