Combinators for bidirectional tree transformations
J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore et al. · ACM Transactions on Programming Languages and Systems · 2007
We propose a novel approach to the view-update problem for tree-structured data: a domain-specific programming language in which all expressions denote bidirectional transformations on trees. In one direction, these transformations---dubbed lenses ---map a concrete tree into a simplified abstract view; in the other, they map a modified abstract view, together with the original concrete tree, to a correspondingly modified concrete tree. Our design emphasizes both robustness and ease of use, guaranteeing strong well-behavedness and totality properties for well-typed lenses. We begin by identifying a natural space of well-behaved bidirectional transformations over arbitrary structures, studying definedness and continuity in this setting. We then instantiate this semantic framework in the form of a collection of lens combinators that can be assembled to describe bidirectional transformations on trees. These combinators include familiar constructs from functional programming (composition, mapping, projection, conditionals, recursion) together with some novel primitives for manipulating trees (splitting, pruning, merging, etc.). We illustrate the expressiveness of these combinators by developing a number of bidirectional list-processing transformations as derived forms. An extended example shows how our combinators can be used to define a lens that translates between a native HTML representation of browser bookmarks and a generic abstract bookmark format.
Cited by 414 works. doi:10.1145/1232420.1232424 Open-access PDF
Authors
References
- Introduction to Database Systems
- Logical Reversibility of Computation
- Irreversibility and heat generation in the computing process
- The Inversion of Functions Defined by Turing Machines
- Introduction to Database Systems
- Data abstraction, views and updates in RIGEL
- Update semantics of relational views
- On the correct translation of update operations on relational views
- The formal semantics of programming languages: an introduction
- The Clio project