Generic Zipper: the context of a traversal by Oleg Kiselyov.
From the webpage:
Zipper: a derivative of a data structure or of its mapping
Zipper is a functional cursor into a data structure. It lets us navigate to and change, without mutation, an item deeply buried in a tree or a nested record. The result is a new data structure, sharing much of its components with the old one. The latter remains available permitting the instant rollback of the changes. Zippers thus implement copy-on-write updates to data structures.
Zipper, the functional cursor into a data structure, is itself a data structure, derived from the original one. The derived data type D’ for the recursive data type D is D with exactly one hole. Filling-in the hole — integrating over all positions of the hole — gives the data type D back. Zipper is the derivative, pretty much in the calculus sense, of a data type. The zipper-as-datatype view was the original presentation, described by Huet (JFP, 1997) and Hinze and Jeuring (JFP 2001); the data structure derivative was expounded by McBride.
We advocate a different view, emphasizing not the result of navigating through a data structure to a desired item and extracting it, but the process of navigation. Each data structure comes with a method to enumerate its components, representing the data structure as a stream of the nodes visited during the enumeration. To let the user focus on a item and submit an update, the enumeration process should yield control to the user once it reached an item. Co-routines provide exactly the right yielding mechanism. As Chung-chieh Shan aptly put it, “zipper is a suspended walk.’
…
‘
A page of short abstracts (part of the first one I quote above) followed by references and often code on zippers.