Abstract
A bidirectional transformation consists of a function get that takes a source (document or value) to a view and a function put that takes an updated view and the original source back to an updated source, governed by certain consistency conditions relating the two functions. Both the database and programming language communities have studied techniques that essentially allow a user to specify only one of get and put and have the other inferred automatically. All approaches so far to this bidirectionalization task have been syntactic in nature, either proposing a domain-specific language with limited expressiveness but built-in (and composable) backward components, or restricting get to a simple syntactic form from which some algorithm can synthesize an appropriate definition for put. Here we present a semantic approach instead. The idea is to take a general-purpose language, Haskell, and write a higher-order function that takes (polymorphic) get-functions as arguments and returns appropriate put-functions. All this on the level of semantic values, without being willing, or even able, to inspect the definition of get, and thus liberated from syntactic restraints. Our solution is inspired by relational parametricity and uses free theorems for proving the consistency conditions. It works beautifully.
- M. Abbott, T. Altenkirch, and N. Ghani. Categories of containers. In Foundations of Software Science and Computational Structures, Proceedings, volume 2620 of LNCS, pages 23--38. Springer-Verlag, 2003. Google Scholar
Digital Library
- F. Bancilhon and N. Spyratos. Update semantics of relational views. ACM Transactions on Database Systems, 6(3):557--575, 1981. Google Scholar
Digital Library
- A. Bohannon, B.C. Pierce, and J.A. Vaughan. Relational lenses: A language for updatable views. In Principles of Database Systems, Proceedings, pages 338--347. ACM Press, 2006. Google Scholar
Digital Library
- A. Bohannon, J.N. Foster, B.C. Pierce, A. Pilkiewicz, and A. Schmitt. Boomerang: Resourceful lenses for string data. In Principles of Programming Languages, Proceedings, pages 407--419. ACM Press, 2008. Google Scholar
Digital Library
- N.A. Danielsson, R.J.M. Hughes, P. Jansson, and J. Gibbons. Fast and loose reasoning is morally correct. In Principles of Programming Languages, Proceedings, pages 206--217. ACM Press, 2006. Google Scholar
Digital Library
- P.F. Dietz and D.D. Sleator. Two algorithms for maintaining order in a list. In Symposium on Theory of Computing, Proceedings, pages 365--372. ACM Press, 1987. Google Scholar
Digital Library
- J.N. Foster, M.B. Greenwald, J.T. Moore, B.C. Pierce, and A. Schmitt. Combinators for bidirectional tree transformations: A linguistic approach to the view--update problem. ACM Transactions on Programming Languages and Systems, 29(3):17, 2007. Google Scholar
Digital Library
- J.N. Foster, A. Pilkiewicz, and B.C. Pierce. Quotient lenses. In International Conference on Functional Programming, Proceedings, pages 383--395. ACM Press, 2008. Google Scholar
Digital Library
- Z. Hu, S.-C. Mu, and M. Takeichi. A programmable editor for developing structured documents based on bidirectional transformations. In Partial Evaluation and Semantics--Based Program Manipulation, Proceedings, pages 178--189. ACM Press, 2004. Google Scholar
Digital Library
- G. Hutton and D. Fulger. Reasoning about effects: Seeing the wood through the trees. In Trends in Functional Programming, Draft Proceedings, 2008.Google Scholar
- P. Johann and J. Voigtländer. Free theorems in the presence of seq. In Principles of Programming Languages, Proceedings, pages 99--110. ACM Press, 2004. Google Scholar
Digital Library
- K. Matsuda, Z. Hu, K. Nakano, M. Hamana, and M. Takeichi. Bidirectionalization transformation based on automatic derivation of view complement functions. In International Conference on Functional Programming, Proceedings, pages 47--58. ACM Press, 2007. Google Scholar
Digital Library
- C. McBride and R. Paterson. Applicative programming with effects. Journal of Functional Programming, 18(1):1--13, 2008. Google Scholar
Digital Library
- A. Pettorossi. Derivation of programs which traverse their input data only once. In Advanced School on Programming Methodologies, Proceedings, pages 165--184. Academic Press, 1987. Google Scholar
Digital Library
- J.C. Reynolds. Types, abstraction and parametric polymorphism. In Information Processing, Proceedings, pages 513--523. Elsevier, 1983.Google Scholar
- C. Strachey. Fundamental concepts in programming languages. In International Summer School in Computer Programming, Lecture Notes, 1967. Reprint appeared in Higher--Order and Symbolic Computation, 13(1--2):11--49, 2000. Google Scholar
Digital Library
- J. Voigtländer. Asymptotic improvement of computations over free monads. In Mathematics of Program Construction, Proceedings, volume 5133 of LNCS, pages 388--403. Springer--Verlag, 2008. Google Scholar
Digital Library
- P. Wadler. Theorems for free! In Functional Programming Languages and Computer Architecture, Proceedings, pages 347--359. ACM Press, 1989. Google Scholar
Digital Library
- P. Wadler. The essence of functional programming (Invited talk). In Principles of Programming Languages, Proceedings, pages 1--14. ACM Press, 1992. Google Scholar
Digital Library
Index Terms
Bidirectionalization for free! (Pearl)
Recommendations
Bidirectionalization for free! (Pearl)
POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesA bidirectional transformation consists of a function get that takes a source (document or value) to a view and a function put that takes an updated view and the original source back to an updated source, governed by certain consistency conditions ...
Semantic bidirectionalization revisited
PEPM '14: Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program ManipulationA bidirectional transformation is a pair of mappings between source and view data objects, one in each direction. When the view is modified, the source is updated accordingly with respect to some laws. Over the years, a lot of effort has been made to ...
Bidirectionalization for free with runtime recording: or, a light-weight approach to the view-update problem
PPDP '13: Proceedings of the 15th Symposium on Principles and Practice of Declarative ProgrammingA bidirectional transformation is a pair of mappings between source and view data objects, one in each direction. When the view is modified, the source is updated accordingly with respect to some laws. Over the years, a lot of effort has been made to ...







Comments