Data.Tree.Zipper
- Package
- purescript-tree
- Repository
- dmbfm/purescript-tree
#Loc Source
newtype Loc aThe Loc type describes the location of a Node inside a Tree. For this
we store the current Node, the sibling nodes that appear before the current
node, the sibling nodes that appear after the current node, and a List of
Locations that store the parent node locations up to the root of the three.
So, effectively, the parents field records the path travelled in the
tree to reach the level of the current Node starting from the tree's root,
and the before and after fields describe its location in the current
level.
Constructors
Instances
#firstChild Source
firstChild :: forall a. Loc a -> Maybe (Loc a)Move the cursor to the first child of the current Node.
#modifyNode Source
modifyNode :: forall a. (Tree a -> Tree a) -> Loc a -> Loc aSet the Node at the current position.
#modifyValue Source
modifyValue :: forall a. (a -> a) -> Loc a -> Loc aModify the value of the current Node.
#insertAfter Source
insertAfter :: forall a. Tree a -> Loc a -> Loc aInsert a node after the current position, and move cursor to the new node.
#insertBefore Source
insertBefore :: forall a. Tree a -> Loc a -> Loc aInsert a node before the current position, and move cursor to the new node.
- Modules
- Data.
Tree - Data.
Tree. Zipper