<div dir="ltr">Hello,<div><br></div><div>I'm trying to understand how I would manipulate a Data.Tree in Haskell. I came across this StackOverflow answer and accompanying blog post, but it doesn't run locally for me:</div><div><br></div><div>* <a href="http://stackoverflow.com/a/15489761/410759">http://stackoverflow.com/a/15489761/410759</a><br></div><div>* <a href="https://www.fpcomplete.com/user/davorak/code-snippets/zipper-tree-examples">https://www.fpcomplete.com/user/davorak/code-snippets/zipper-tree-examples</a></div><div><br></div><div>Here's a gist with the code and the error I'm seeing: <a href="https://gist.github.com/zmoazeni/0049f3ab365ae600b131">https://gist.github.com/zmoazeni/0049f3ab365ae600b131</a></div><div><br></div><div>I just want to start slow and be able to do three actions:</div><div><br></div><div>* add +10 to all values in the tree</div><div>* add a node to an existing node's subForest</div><div>* remove a node (along with its subForest) from the tree</div><div><br></div><div>I understand that this won't actually "edit in place" and my code would need to call a function which would return an updated version of the original tree.</div><div><br></div><div>Finally, Lens wasn't my first choice. I was trying to understand Zippers from <a href="http://learnyouahaskell.com/zippers">http://learnyouahaskell.com/zippers</a> and my brain seized. I'm just falling back to Lens because it seems like the simplest/dsl-ish way to manipulate structures like this.</div><div><br></div><div>Thanks for any help!</div><div>-Zach</div></div>