Retentive Lenses

by   Zirun Zhu, et al.

Based on Foster et al.'s lenses, various bidirectional programming languages and systems have been developed for helping the user to write correct data synchronisers. The two well-behavedness laws of lenses, namely Correctness and Hippocraticness, are usually adopted as the guarantee of these systems. While lenses are designed to retain information in the source when the view is modified, well-behavedness says very little about the retaining of information: Hippocraticness only requires that the source be unchanged if the view is not modified, and nothing about information retention is guaranteed when the view is changed. To address the problem, we propose an extension of the original lenses, called retentive lenses, which satisfy a new Retentiveness law guaranteeing that if parts of the view are unchanged, then the corresponding parts of the source are retained as well. As a concrete example of retentive lenses, we present a domain-specific language for writing tree transformations; we prove that the pair of get and put functions generated from a program in our DSL forms a retentive lens. We demonstrate the practical use of retentive lenses and the DSL by presenting case studies on code refactoring, Pombrio and Krishnamurthi's resugaring, and XML synchronisation.


page 1

page 2

page 3

page 4


Synthesizing Bijective Lenses

Bidirectional transformations between different data representations occ...

The potential of LLMs for coding with low-resource and domain-specific programming languages

This paper presents a study on the feasibility of using large language m...

Towards a Complete Picture of Lens Laws

Bidirectional transformation, also called lens, has played important rol...

Automating the Diagram Method to Prove Correctness of Program Transformations

We report on the automation of a technique to prove the correctness of p...

Traced Types for Safe Strategic Rewriting

Strategy languages enable programmers to compose rewrite rules into stra...

A metalanguage for cost-aware denotational semantics

We present two metalanguages for developing synthetic cost-aware denotat...

Please sign up or login with your details

Forgot password? Click here to reset