[Haskell-cafe] Re: Updating doubly linked lists

Derek Elkins derek.a.elkins at gmail.com
Thu Jan 1 19:18:32 EST 2009


On Fri, 2009-01-02 at 10:48 +1100, S. Günther wrote:
> > Whether circular or not, sharing values by using a "back pointer" is
> > problematic for any update. Why not use a zipper instead?
> I looked into zippers before and the problem I had was that they never
> really matched the structure which I needed and which led me to think
> about this whole knot tying thing again.[1] The things I read about them
> always assumed either a list like (i.e. linear) or a tree like (i.e. existence
> of a root) structure on the type to be plugged into the zipper. Now I know
> that this is not necessary and there are references to a generic zipper
> implementation but the thing is that I only found the source code and
> decided to first look into the knot tying thing before opening another
> can of worms with delimited continuations since I already spend too
> muchtime thinking about that stuff.[2] So if anyone has pointers to a
> good generic zipper explanation I would be thankful. Note that I don't
> need full blown error handling. I would first like to understand the basics.
> Now I think I came to the conclusion that locally updating a tied knot in a
> pure way really is hard and that it's not me just not seeing some obvious
> solution. So I just have to decide whether to use IORefs/Vars (clunky)
> or to implement zippers for the structure I need (probably toohard for me).
> Anyways thanks for all the answers from which I learned a few unexpected
> things and which assured me that my instincts aren't that far off.

Read this http://strictlypositive.org/diff.pdf (again)



More information about the Haskell-Cafe mailing list