Blog post: Tying the Knot

I wrote up a blog post discussing tying the knot in Haskell, using doubly linked lists as a motivating example, and then demonstrating how these technique is leveraged in xml-conduit to provide XPath-style traversals.

7 Likes

I wonder how this relates to zippers. It sounds to me like you can avoid rebuilding the entire structure when you want to change one item by using zippers. That also makes me think of the funcitonal pearl: “Weaving a Web” by Hinze and Jeuring. I wonder what the advantages and disadvantages are for all these approaches.

Edit: I implemented and extended some of the ideas from that paper here: https://gist.github.com/noughtmare/89bb772ab8b4fb9001ce67d0a0619429

1 Like

I’m not familiar enough to make a comparison, I’d certainly be interested if anyone else has any thoughts on this.

Another example of library which uses knot-tying is grammatical-parsers by @blamario.

1 Like