Composing Bidirectional Programs Monadically

被引:5
|
作者
Xia, Li-yao [1 ]
Orchard, Dominic [2 ]
Wang, Meng [3 ]
机构
[1] Univ Penn, Philadelphia, PA 19104 USA
[2] Univ Kent, Canterbury, Kent, England
[3] Univ Bristol, Bristol, Avon, England
基金
英国工程与自然科学研究理事会;
关键词
D O I
10.1007/978-3-030-17184-1_6
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页码:147 / 175
页数:29
相关论文
共 50 条