一元地编写双向程序(带附录)
Composing bidirectional programs monadically (with appendices)
摘要:
软件经常将数据从一种表示转换为另一种表示,反之亦然。单纯地分别指定两个转换方向是容易出错的,并且会引入概念上的重复。相反,双向编程技术允许编写可以在两个方向上解释的程序。然而,这些技术通常通过受限的、专门的组合子库使用不熟悉的编程习惯。相反,我们引入了一个框架组成双向程序monadically,使双向编程与熟悉的抽象函数语言,如Haskell。我们证明了我们的方法适用于解析器/打印机,镜头和发电机/谓词的一般性。我们将展示如何利用组合性和等式推理验证这种一元双向程序的往返特性。
英文摘要:
Software frequently converts data from one representation to another and vice versa. Naively specifying both conversion directions separately is error prone and introduces conceptual duplication. Instead, bidirectional programming techniques allow programs to be written which can be interpreted in both directions. However, these techniques often employ unfamiliar programming idioms via restricted, specialised combinator libraries. Instead, we introduce a framework for composing bidirectional programs monadically, enabling bidirectional programming with familiar abstractions in functional languages such as Haskell. We demonstrate the generality of our approach applied to parsers/printers, lenses, and generators/predicates. We show how to leverage compositionality and equational reasoning for the verification of round-tripping properties for such monadic bidirectional programs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。