Affiliation:
1. Imperial College London, UK
2. University of Bristol, UK
Abstract
Functional programmers have an established tradition of using traversals as a design pattern to work with recursive data structures. The technique is so prolific that a whole host of libraries have been designed to help in the task of automatically providing traversals by analysing the generic structure of data types. More recently, lenses have entered the functional scene and have proved themselves to be a simple and versatile mechanism for working with product types. They make it easy to focus on the salient parts of a data structure in a composable and reusable manner.
This paper uses the combination of lenses and traversals to give rise to a library with unprecedented expressivity and flexibility for querying and modifying complex data structures. Furthermore, since lenses and traversals are based on the generic shape of data, this information is used to generate code that is as efficient as hand-optimised versions. The technique leverages the structure of data to produce generic abstractions that are then eliminated by the standard workhorses of modern functional compilers: inlining and specialisation.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference37 articles.
1. Template your boilerplate
2. Optimizing SYB is easy!
3. Optimizing SYB traversals is easy!
4. Lennart Augustsson. 2018. geniplate-mirror-0.7.6 library. http://hackage.haskell.org/package/geniplate-mirror-0.7.6 Lennart Augustsson. 2018. geniplate-mirror-0.7.6 library. http://hackage.haskell.org/package/geniplate-mirror-0.7.6
5. Understanding idiomatic traversals backwards and forwards
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Staged sums of products;Proceedings of the 13th ACM SIGPLAN International Symposium on Haskell;2020-08-09
2. Describing microservices using modern Haskell (experience report);Proceedings of the 13th ACM SIGPLAN International Symposium on Haskell;2020-08-09
3. Staged selective parser combinators;Proceedings of the ACM on Programming Languages;2020-08-02
4. A promise checked is a promise kept: inspection testing;ACM SIGPLAN Notices;2018-12-07
5. A promise checked is a promise kept: inspection testing;Proceedings of the 11th ACM SIGPLAN International Symposium on Haskell;2018-09-17