Skip to main content

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

Matsuda, Kazutaka and Wang, Meng (2013) Bidirectionalization for Free with Runtime Recording: Or, a Light-Weight Approach to the View-Update Problem. In: Proceedings of the 15th Symposium on Principles and Practice of Declarative Programming. PPDP Principles and Practice of Declarative Programming . ACM, New York, USA, pp. 297-308. ISBN 978-1-4503-2154-9. (doi:10.1145/2505879.2505888) (KAR id:47480)

PDF Author's Accepted Manuscript
Language: English
Download (393kB)
[thumbnail of local_180809.pdf]
This file may not be suitable for users of assistive technology.
Request an accessible format
Official URL:


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 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 polymorphism requirement to improve the applicability of semantic bidirectionalization. Concretely, we provide a type class PackM γ α μ, which intuitively reads "a concrete datatype γ is abstracted to a type α, and the 'observations' made by a transformation on values of type γ are recorded by a monad μ". With PackM, we turn monomorphic transformations into polymorphic ones, that are 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.

Item Type: Book section
DOI/Identification number: 10.1145/2505879.2505888
Uncontrolled keywords: Bidirectional Transformation, Free Theorem, Type Class, Haskell, XML Transformation
Subjects: Q Science > QA Mathematics (inc Computing science) > QA 75 Electronic computers. Computer science
Q Science > QA Mathematics (inc Computing science) > QA 76 Software, computer programming,
Divisions: Divisions > Division of Computing, Engineering and Mathematical Sciences > School of Computing
Depositing User: Meng Wang
Date Deposited: 01 Mar 2015 00:31 UTC
Last Modified: 16 Nov 2021 10:19 UTC
Resource URI: (The current URI for this page, for reference purposes)
  • Depositors only (login required):


Downloads per month over past year