Monadic combinators for "Putback" style bidirectional programming

Hugo Pacheco, Zhenjiang Hu, Sebastian Fischer
2014 Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation - PEPM '14  
Bidirectional transformations, in particular lenses, are programs with a forward get transformation and a backward putback transformation that keep source and view data types synchronized. Several bidirectional programming languages exist to aid programmers in writing a (sort of) forward transformation, and deriving a backward transformation for free. However, the maintainability offered by such languages comes at the cost of expressiveness and (more importantly) predictability because the
more » ... uity of synchronization -handled by the putback transformation-is solved by default strategies over which programmers have little control. In this paper, we argue that controlling such ambiguity is essential for bidirectional transformations and propose a novel language in which programmers write a (sort of) putback transformation, and get the unique get transformation for free. Like traditional bidirectional languages, our put-oriented language allows reasoning about the correctness of defined transformations from the properties of their building blocks. But it allows programmers to describe the behavior of a bidirectional transformation much more precisely, while retaining the maintainability of writing a single program. We demonstrate the practical power of the new approach through a series of examples, ranging from simple ones that illustrate traditional lenses to complex ones for which our putback-based approach is central to specifying nontrivial update strategies.
doi:10.1145/2543728.2543737 dblp:conf/pepm/PachecoHF14 fatcat:tgu6phbgenfhfaj4765knvtghy