Journal of Functional Programming
Proceedings of the 2006 workshop on ML
Scrap your boilerplate with XPath-like combinators
Proceedings of the 34th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
A static simulation of dynamic delimited control
Higher-Order and Symbolic Computation
Electronic Notes in Theoretical Computer Science (ENTCS)
Scrap your zippers: a generic zipper for heterogeneous types
Proceedings of the 6th ACM SIGPLAN workshop on Generic programming
Incremental updates for efficient bidirectional transformations
Proceedings of the 16th ACM SIGPLAN international conference on Functional programming
Hi-index | 0.00 |
Suppose, you want to implement a structured editor for some term type, so that the user can navigate through a given term and perform edit actions on subterms. In this case you are immediately faced with the problem of how to keep track of the cursor movements and the user's edits in a reasonably efficient manner. In a previous pearl, Huet (1997) introduced a simple data structure, the Zipper, that addresses this problem – we will explain the Zipper briefly in section 2. A drawback of the Zipper is that the type of cursor locations depends on the structure of the term type, i.e. each term type gives rise to a different type of location (unless you are working in an untyped environment). In this pearl, we present an alternative data structure, the web, that serves the same purpose, but that is parametric in the underlying term type. Sections 3–6 are devoted to the new data structure. Before we unravel the Zipper and explore the web, let us first give a taste of their use.