allo-media/canopy

OpenPath

Opened this issue · 1 comments

The layz-tree-with-zipper library has openPath https://package.elm-lang.org/packages/turboMaCk/lazy-tree-with-zipper/latest/Lazy-Tree-Zipper#openPath

Do you think this would make sense for canopy as well? I can imagine a targeted depth-first search would be more efficient than an untargeted one or a breadth-first search.

A stub implementation would be

findCurrent path tree =
    case List.reverse path of
        id :: _ -> Canopy.seek (\el -> el.id == id) tree
        _ -> Nothing

But this is not as performant as it could be.