Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For those, like me, who might not be familiar with those terms, this StackOverflow question strives to answer it:

https://stackoverflow.com/questions/36851766/histomorphisms-...

Oh, and what is a zipper as a data structure?



I'll preface: this is more of an interesting connection, rather than a direct answer to your question.

Zippers can be seen as (or at least isomorphic to) the derivative of a type with respect to one of its type parameters. This is described in Conor McBride's paper "The Derivative of a Regular Type is its Type of One-Hole Contexts."

http://strictlypositive.org/diff.pdf

If a video is more your speed, Kenneth Foner gave a great talk titled "`choose` your own derivative" that takes the concept of derivatives of types and takes it a step further. You can skip to the 11 minute mark to watch his explanation of zippers as derivatives here:

https://www.youtube.com/watch?v=79zzgL75K8Q&t=11m

With that said, the standard go-to paper for Zippers would probably be "The Zipper" by Gerard Huet:

http://gallium.inria.fr/~huet/PUBLIC/zip.pdf


It's usually some kind of "cursor into" a datastructure, that gives you both the "focus" / point you're operating at and also the rest of the surrounding datastructure. They tend to be comonadic and a nice way to express transformations where an element depends on its neighbours (but I'm wondering whether folding down the structure with history would achieve the same thing, hence the morphism suggestion). https://wiki.haskell.org/Zipper




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: