Last week, I was trying to write an algorithm with Zippers to update a specific element in a nested data structure, How to move an element within a structure, possibly with zippers?
My answer there solves the problem for that exact structure, nesting more elements breaks the algorithm.
That made think, is it possible to write a generic algorithm with Zippers to update a specific data in a nested data structure (no matter how nested it is)? Or Zippers are only when you know your steps exactly?
I need to understand that, properly I'm trying to make Zippers do something that isn't what Zippers are created for.
Absolutely you can use zippers in this way, as you can move around a zip in any direction you choose. As an example have a look at the zip-visit library, which offers arbitrary visiting over zippers, with the ability to change nodes as required.
An example taken from the docs:
Of course, you can also use simple walking to accomplish similar tasks, an example of which is on this SO question on traversing maps.