Last May I gave a talk at the HaskellDC Users Group on a very cool and new (to me) data structure called zippers. Slides are attached to this post.
So what are zippers? We’ve all had to iterate through a data structure — element by element through a list, through levels and nodes in a tree, and perhaps even taken an odd path through an ad-hoc structure. But sometimes, we’d like to stop and pause part way through an iteration. Or perhaps we’d like to change direction and do something different based on what we see. Like when building a web browser, we’d like to be able to go forwards or backwards through user’s history based on input we don’t yet have. Zippers provide a structure and a technique that allow us to freeze iteration through a data structure into it’s own structure. We can step through this structure, modify it, and otherwise interact with it like any other data structure. But doing so allows us to control the specific path we take, while still allowing us to fix the shape of the path in terms of the iteration that opened the zipper.
Audio and video are possibly available for this talk. If you’re interested, reach out and I’ll see if I can get them posted.
Thanks for reading!