paperbot · PL 论文追踪

RSS

‘do’ unchained: embracing local imperativity in a purely functional language (functional pearl)

ICFP 6(ICFP)2022
Sebastian Ullrich, Leonardo de Moura

尚未生成 AI 速览(可能缺少 API key 或等待下次运行补跑)。

原文摘要(Abstract)

Purely functional programming languages pride themselves with reifying effects that are implicit in imperative languages into reusable and composable abstractions such as monads. This reification allows for more exact control over effects as well as the introduction of new or derived effects. However, despite libraries of more and more powerful abstractions over effectful operations being developed, syntactically the common 'do' notation still lags behind equivalent imperative code it is supposed to mimic regarding verbosity and code duplication. In this paper, we explore extending 'do' notation with other imperative language features that can be added to simplify monadic code: local mutation, early return, and iteration. We present formal translation rules that compile these features back down to purely functional code, show that the generated code can still be reasoned over using an implementation of the translation in the Lean 4 theorem prover, and formally prove the correctness of the translation rules relative to a simple static and dynamic semantics in Lean.

链接与引用

DOI 原文 ·

BibTeX
@article{paperbot1497,
  title = {‘do’ unchained: embracing local imperativity in a purely functional language (functional pearl)},
  author = {Sebastian Ullrich and Leonardo de Moura},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {6},
  number = {ICFP},
  year = {2022},
  doi = {10.1145/3547640}
}