Bidirectionalization for Free with Runtime Recording: Or, a Light-Weight Approach to the View-Update Problem
Paper in proceeding, 2013

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. Over the years, a lot of effort has been made to offer better language support for programming such transformations. In particular, a technique known as \emph{bidirectionalization} is able to analyze and transform unidirectional programs written in general purpose languages, and "bidirectionalize" them. Among others, a technique termed as semantic bidirectionalization proposed by Voigtländer stands out in term of user-friendliness. The unidirectional program can be written using arbitrary language constructs, as long as the function is polymorphic and the language constructs respect parametricity. The free theorems that follow from the polymorphic type of the program allow a kind of forensic examination of the transformation, determining its effect without examining its implementation. This is convenient, in the sense that the programmer is not restricted to using a particular syntax; but it does require the transformation to be polymorphic. In this paper, we lift this polymorphic requirement to improve the applicability of semantic bidirectionalization. Concretely, we provide a type class PackM; intuitively "PackM c a m'' reads "a concrete datatype c is abstracted to a type a, and the 'observations' made by a transformation on values of type c are recorded by a monad m''. With PackM, we turn monomorphic transformations into polymorphic ones, ready to be bidirectionalized. We demonstrate our technique with a case study of standard XML queries, which were considered beyond semantic bidirectionalization because of their monomorphic nature.

Bidirectional Transformation

Type Class

Free Theorem

Haskell

XML Transformation

Author

Kazutaka Matsuda

University of Tokyo

Meng Wang

Chalmers, Computer Science and Engineering (Chalmers), Software Technology (Chalmers)

Proceedings of the 15th Symposium on Principles and Practice of Declarative Programming, PPDP 2013

297-308
978-145032154-9 (ISBN)

Areas of Advance

Information and Communication Technology

Subject Categories

Computer and Information Science

DOI

10.1145/2505879.2505888

ISBN

978-145032154-9

More information

Latest update

2/28/2018