Applicative bidirectional programming with lenses

A 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. One way to reduce the development and maintenance effort of bidirectional transformations is to have specialized languages in which the resulting programs are bidirectional by construction---giving rise to the paradigm of bidirectional programming. In this paper, we develop a framework for applicative-style and higher-order bidirectional programming, in which we can write bidirectional transformations as unidirectional programs in standard functional languages, opening up access to the bundle of language features previously only available to conventional unidirectional languages. Our framework essentially bridges two very different approaches of bidirectional programming, namely the lens framework and Voigtländer's semantic bidirectionalization, creating a new programming style that is able to bag benefits from both.

[1]  Ross Paterson,et al.  A new notation for arrows , 2001, ICFP '01.

[2]  Kazutaka Matsuda,et al.  Gradual Refinement , 2010, MPC.

[3]  Benjamin C. Pierce,et al.  Matching lenses: alignment and view update , 2010, ICFP '10.

[4]  Janis Voigtländer Free theorems involving type constructor classes: functional pearl , 2009, ICFP.

[5]  Philip Wadler,et al.  Idioms are Oblivious, Arrows are Meticulous, Monads are Promiscuous , 2011, Electron. Notes Theor. Comput. Sci..

[6]  Nicolas Spyratos,et al.  Update semantics of relational views , 1981, TODS.

[7]  Meng Wang,et al.  Enhancing semantic bidirectionalization via shape bidirectionalizer plug-ins , 2013, J. Funct. Program..

[8]  Dongxi Liu,et al.  Towards automatic model synchronization from model transformations , 2007, ASE.

[9]  Meng Wang,et al.  Semantic bidirectionalization revisited , 2014, PEPM '14.

[10]  Meng Wang,et al.  Bidirectionalization for free with runtime recording: or, a light-weight approach to the view-update problem , 2013, PPDP.

[11]  Kazutaka Matsuda,et al.  Bidirectionalization transformation based on automatic derivation of view complement functions , 2007, ICFP '07.

[12]  Benjamin C. Pierce,et al.  Boomerang: resourceful lenses for string data , 2008, POPL '08.

[13]  Meng Wang,et al.  "Bidirectionalization for free" for monomorphic transformations , 2015, Sci. Comput. Program..

[14]  Meng Wang,et al.  Combining syntactic and semantic bidirectionalization , 2010, ICFP '10.

[15]  Stephen J. Hegner,et al.  Foundations of Canonical Update Support for Closed Database Views , 1990, ICDT.

[16]  Janis Voigtländer Bidirectionalization for free! (Pearl) , 2009, POPL '09.

[17]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[18]  Meng Wang,et al.  Incremental updates for efficient bidirectional transformations , 2011, ICFP '11.

[19]  Shin-Cheng Mu,et al.  A programmable editor for developing structured documents based on bidirectional transformations , 2004, PEPM '04.

[20]  Adam Chlipala Parametric higher-order abstract syntax for mechanized semantics , 2008, ICFP.

[21]  Leonidas Fegaras,et al.  Propagating updates through XML views using lineage tracing , 2010, 2010 IEEE 26th International Conference on Data Engineering (ICDE 2010).

[22]  Kazutaka Matsuda,et al.  Bidirectionalizing graph transformations , 2010, ICFP '10.

[23]  Benjamin C. Pierce,et al.  Combinators for bi-directional tree transformations: a linguistic approach to the view update problem , 2005, POPL '05.

[24]  Zhenjiang Hu,et al.  Monadic combinators for "Putback" style bidirectional programming , 2014, PEPM '14.

[25]  S-C. Mu,et al.  An algebraic approach to bidirectional updating , 2004 .

[26]  Ross Paterson,et al.  Constructing Applicative Functors , 2012, MPC.

[27]  Meng Wang,et al.  Refactoring pattern matching , 2013, Sci. Comput. Program..

[28]  James Cheney,et al.  Lenses for Web Data , 2013, Electron. Commun. Eur. Assoc. Softw. Sci. Technol..

[29]  Martin Hofmann,et al.  Symmetric lenses , 2011, POPL '11.

[30]  Russell O'Connor Video presentation of Functor : Lens :: Applicative : Biplate: Introducing Multiplate , 2011, WGP@ICFP.

[31]  Conor McBride,et al.  Applicative programming with effects , 2008, J. Funct. Program..

[32]  Umeshwar Dayal,et al.  On the correct translation of update operations on relational views , 1982, TODS.

[33]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[34]  Yijun Yu,et al.  Maintaining invariant traceability through bidirectional transformations , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[35]  Russell O'Connor Functor is to Lens as Applicative is to Biplate: Introducing Multiplate , 2011, ArXiv.

[36]  Donald E. Knuth,et al.  A Web Service Architecture for Bidirectional XML Updating , 2006 .

[37]  Tom Schrijvers,et al.  Understanding idiomatic traversals backwards and forwards , 2013, Haskell '13.

[38]  Kazutaka Matsuda,et al.  Three Complementary Approaches to Bidirectional Programming , 2010, SSGIP.

[39]  Shin-Cheng Mu,et al.  An Algebraic Approach to Bi-directional Updating , 2004, APLAS.

[40]  Russell O'Connor,et al.  A representation theorem for second-order functionals , 2015, J. Funct. Program..

[41]  Benjamin C. Pierce,et al.  Quotient lenses , 2008, ICFP.