Affiliation:
1. University of Pennsylvania, Philadelphia, PA
2. Bell Labs, Lucent Technologies
3. University of Pennsylvania
4. INRIA Rhône-Alpes
Abstract
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.
Publisher
Association for Computing Machinery (ACM)
Cited by
205 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Bidirectional Data Transformations;Proceedings of the 2nd ACM SIGPLAN International Workshop on Functional Software Architecture;2024-08-28
2. Fusing Direct Manipulations into Functional Programs;Proceedings of the ACM on Programming Languages;2024-01-05
3. Sparcl: A language for partially invertible computation;Journal of Functional Programming;2024
4. Region Quadtrees Verified;Lecture Notes in Computer Science;2024
5. Reconciling Partial and Local Invertibility;Lecture Notes in Computer Science;2024