zipper is:module -package:streams -package:traverse-with-class

A zipper is a structure for walking a value and manipulating it in constant time. This module was inspired by the paper: Michael D. Adams. Scrap Your Zippers: A Generic Zipper for Heterogeneous Types, Workshop on Generic Programming 2010.
This module provides a two-dimensional text zipper data structure. This structure represents a body of text and an editing cursor which can be moved throughout the text, along with a set of editing transformations. Text zippers are generalized over the set of data types that might be used to store lists of characters (e.g., String, Text, etc.). As a result, the most general way to create a text zipper is to use mkZipper and provide all of the functions required to manipulate the underlying text data. Implementations using Text and String are provided.
This module provides a Zipper with fairly strong type checking guarantees. The code here is inspired by Brandon Simmons' zippo package, but uses a different approach to represent the Zipper that makes the whole thing look like his breadcrumb trail, and can move side-to-side through traversals. Some examples types: Since individual levels of a Zipper are managed by an arbitrary IndexedTraversal, you can move left and right through the IndexedTraversal selecting neighboring elements.
>>> zipper ("hello","world") & downward _1 & fromWithin traverse & focus .~ 'J' & rightmost & focus .~ 'y' & rezip
("Jelly","world")
This is particularly powerful when compiled with plate, uniplate or biplate for walking down into self-similar children in syntax trees and other structures. Given keys in ascending order you can jump directly to a given key with moveTo. When used with traversals for balanced tree-like structures such as an IntMap or Map, searching for a key with moveTo can be done in logarithmic time.
Creation date: Thu Jul 23 08:42:37 2020.
Zipper over the Data.Tree data structure. This module is based on rosezipper.