Depth-typed functor-based trees, both top-down and bottom-up