一句话:提出应用式高阶双向编程框架,让双向变换能以标准函数式语言中的单向程序编写,并桥接 lens 与语义双向化两种方法。
双向变换由源与视图之间的一对映射组成,视图被修改后需按一定法则更新源。为降低开发与维护成本,双向编程语言让程序从构造上就是双向的。本文提出一个支持应用式与高阶双向编程的框架,允许在标准函数式语言中像写单向程序一样编写双向变换,从而复用传统单向语言已有的语言特性。该框架本质上桥接了双向编程中两种差异很大的方法——lens 框架与 Voigtländer 的语义双向化,形成一种能兼取两者优点的新编程风格。
Abstract 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 obtain benefits from both.