Make printing even more peephole-optimized by printing from the "inside out". This is a pie-in-the-sky enhancement.
How this could be done:
Give PrettyDoc a parent() method. (This means implementors won't be able to be just a &struct Tree(Vec<Tree>) anymore.)
Have pretty_print() take a PrettyDoc node to print at instead of a path: Vec<usize>.
When printing, start at the focal node and print "up". This would be a big change to the printing algorithm. But possible, since Notations are so declarative: e.g. it's possible to start in the middle of a fold.
Make printing even more peephole-optimized by printing from the "inside out". This is a pie-in-the-sky enhancement.
How this could be done:
PrettyDoc
a parent() method. (This means implementors won't be able to be just a&struct Tree(Vec<Tree>)
anymore.)pretty_print()
take aPrettyDoc
node to print at instead of apath: Vec<usize>
.fold.