[Haskell-cafe] Which generic zipper?
Roman Cheplyaka
roma at ro-che.info
Thu Apr 11 00:19:51 CEST 2013
* Luke Evans <luke at eversosoft.com> [2013-04-10 15:00:40-0700]
> It's sometimes difficult to figure out a good choice when you're searching for a new feature/library (when you go beyond safety of the HP).
> I'm looking for a generic zipper to (hopefully) navigate over an AST… so a hetrogeneous structure.
>
> It's probably sufficient to make this traversable in a fixed way, but a zipper seemed like a good idea.
> Google says there are lots of options (various papers and their related implementations etc).
>
> I see a generic zipper in an 'syz' package that is based on generics, which looks like a nice choice as it's now easy to add the extension for deriving generics on ADTs.
> However, that package looks pretty old and unmaintained.
>
> Does anyone have any suggestions/advice?
I plan to add an syz-like zipper to traverse-with-class[1] soon.
The main advantage is that it'll let you to specify, via GTraversable
instances, at which nodes it should "stop" and which nodes it should
"skip".
[1]: http://hackage.haskell.org/package/traverse-with-class
For example, when you navigate around a list with syz, it'll "stop" at
(:) and [] nodes, apart from the actual list elements, which may or may
not be what you want.
Apart from that, I am not aware of any problems with syz.
Roman
More information about the Haskell-Cafe
mailing list