计算机科学 > 程序设计语言
[提交于 2019年9月11日]
标题:Structural and semantic pattern matching analysis in Haskell
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要:Haskell functions are defined as a series of clauses consisting of patterns that are matched against the arguments in the order of definition. In case an input is not matched by any of the clauses, an error occurs. Therefore it is desirable to statically prove that the function is defined for all well-typed inputs. Conversely, a clause that can never be matched also indicates a likely defect. Analyzing these properties is challenging due to presence of GADT and guards as well as due to Haskell's lazy evaluation. We implement a recently proposed algorithm that unifies and extends the related analyses implemented in version 7 of the Glasgow Haskell Compiler. By using an SMT solver to handle the semantic constraints arising from pattern guards, we achieve a further improvement in precision over the existing GHC 8.0.1 implementation. We present a tool that uses the analysis to give sound, more precise, and actionable warnings about program defects.
提交历史
来自:Pavel Kalvoda[v1] 2019年9月11日 星期三 00:00:00 UTC