icicle-lang / icicle-ambiata

A streaming query language.
BSD 3-Clause "New" or "Revised" License
57 stars 11 forks source link

Generalise syntax traversals and folds #657

Open tranma opened 6 years ago

tranma commented 6 years ago

Some transformations and traversals, such as freevars for finding all free names in an expression, do the recursive traversal by hand. Short of beating something out of lens, I think we could use this approach here: https://www.twanvl.nl/blog/haskell/traversing-syntax-trees (replace the Depth parameter with the "context" of the traversal or fold, e.g. the set of names, the annotation, the current primitive fragment).