Implement client actions properly

This commit is contained in:
Joscha 2020-02-10 23:49:34 +00:00
parent 5902421872
commit 70e3386cb5
2 changed files with 41 additions and 12 deletions

View file

@ -5,6 +5,7 @@ module Forest.Client.Tree
, renderTree
-- * Focused element
, getCurrent
, getCurrentPath
, moveUp
, moveDown
-- * Folding
@ -85,6 +86,10 @@ getCurrent :: Tree -> Node
-- We rely on the invariant that the focused node always exists
getCurrent tree = fromJust $ applyPath (treeFocused tree) (treeNode tree)
-- | Get the path of the currently focused node.
getCurrentPath :: Tree -> Path
getCurrentPath = treeFocused
flatten :: Node -> [Path]
flatten node =
let flattenedChildren =