paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Keep your laziness in check

管住你的惰性
ICFP 2(ICFP)2018匹配度 1/10 · 该论文研究 Haskell 函数严格性的基于属性的随机测试,属于函数式程序动态测试与调试,与用户关注的静态分析、LLM/Agent、浮点程序分析及贝叶斯程序分析均无直接关联。引用 7 inbox
Kenneth Foner, Hengchu Zhang, Leonidas Lampropoulos
crossref: 2026-09-10

AI 速览

一句话:提出 StrictCheck,用基于属性的随机测试规定并检验 Haskell 函数的严格性。

严格性通常被视为非函数式属性,难以直接规定与测试。本文提出 StrictCheck:一个基于属性的随机测试框架,用于观察、规定和测试 Haskell 函数的严格性。它通过具体化(reify)对数据结构的求值需求,使其能在 Haskell 内被操纵与检查。为此需解决三点:精确规定函数严格性、高效观察数据结构求值、正确生成具有随机严格性的函数。StrictCheck 能以常数因子开销测试任意 Haskell 函数(含高阶函数),且对 Haskell 标准代数数据类型无需模板代码;其低层但表达力强的规约语言可作为未来高层抽象的基础。作者还用它为 Okasaki 常数时间纯函数队列建立了正确规约,该结构性质本质上依赖微妙的惰性使用。

问题
严格性传统上被视为非函数式属性,缺少能像普通属性一样规定和检验 Haskell 函数严格性的手段。
方法
提出 StrictCheck,将被求值需求具体化,在 Haskell 中观察和操纵数据结构求值,并设计规约语言与随机严格性函数生成机制。
评估
实现通用动态严格性测试框架,以常数因子开销测试任意 Haskell 函数(含高阶函数),无需标准代数数据类型的模板代码,并为 Okasaki 常数时间纯函数队列给出正确规约。
原文摘要(Abstract)

We introduce StrictCheck: a property-based random testing framework for observing, specifying, and testing the strictness of Haskell functions. Strictness is traditionally considered a non-functional property; StrictCheck allows it to be tested as if it were one, by reifying demands on data structures so they can be manipulated and examined within Haskell. Testing strictness requires us to 1) precisely specify the strictness of functions, 2) efficiently observe the evaluation of data structures, and 3) correctly generate functions with random strictness. We tackle all three of these challenges, designing an efficient generic framework for precise dynamic strictness testing. StrictCheck can specify and test the strictness of any Haskell function---including higher-order ones---with only a constant factor of overhead, and requires no boilerplate for testing functions on Haskell-standard algebraic data types. We provide an expressive but low-level specification language as a foundation upon which to build future higher-level abstractions. We demonstrate a non-trivial application of our library, developing a correct specification of a data structure whose properties intrinsically rely on subtle use of laziness: Okasaki's constant-time purely functional queue.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot293,
  title = {Keep your laziness in check},
  author = {Kenneth Foner and Hengchu Zhang and Leonidas Lampropoulos},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {2},
  number = {ICFP},
  year = {2018},
  doi = {10.1145/3236797}
}