Allows foldPositions to be nested, only replace and delete makes sense here (afaict).
As such, when wholeTree is false, the path (which must be a tree) is transformed
p => top(p.tree)
and a special case for "deletes" is made - when RemovedRoot is returned from the transformation a delete will take place on the Path. This enforces that only replace and removes are possible and function appropriately.
Warning:
When wholeTree is true the function f is passed the Path (or item) in the original tree, any transformations are then conusmed across the whole tree, which is likely not desired.
Allows foldPositions to be nested, only replace and delete makes sense here (afaict).
As such, when wholeTree is false, the path (which must be a tree) is transformed
p => top(p.tree)
and a special case for "deletes" is made - when RemovedRoot is returned from the transformation a delete will take place on the Path. This enforces that only replace and removes are possible and function appropriately.
Warning:
When wholeTree is true the function f is passed the Path (or item) in the original tree, any transformations are then conusmed across the whole tree, which is likely not desired.