/** * Convert a `Tree` into a `Tree` using a function from `Tree => B` * applied to each node in the Tree. * * @tsplus static Tree.Aspects extend * @tsplus pipeable Tree extend */ export function extend(f: (wa: Tree) => B) { return (self: Tree): Tree => Tree(f(self), self.forest.map((_) => _.extend(f))) }