Composing Bidirectional Programs Monadically

Li-yao Xia, Dominic Orchard, Meng Wang

Research output: Chapter in Book/Report/Conference proceedingConference contribution


Software frequently converts data from one representation to another and vice versa. Naïvely 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.
Original languageEnglish
Title of host publicationProgramming Languages and Systems
EditorsLuís Caires
Place of PublicationCham
PublisherSpringer International Publishing Switzerland
Number of pages29
ISBN (Electronic)978-3-030-17184-1
ISBN (Print)978-3-030-17183-4
Publication statusPublished - 6 Apr 2019
Event28th European Symposium on Programming - Prague, Czech Republic
Duration: 8 Apr 201911 Apr 2019
Conference number: 28

Publication series

NameLecture Notes in Computer Science
PublisherSpringer Cham
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Symposium28th European Symposium on Programming
Abbreviated titleESOP 2019
Country/TerritoryCzech Republic
Internet address


Dive into the research topics of 'Composing Bidirectional Programs Monadically'. Together they form a unique fingerprint.

Cite this