[{"name":"RoseTree.Path","comment":" The path of a `RoseTree.Tree` node is represented as a `List Int`.\n\nThis module provides functions for path manipulation.\n\n@docs next, parent, ancestor\n\n","unions":[],"aliases":[],"values":[{"name":"ancestor","comment":" Find a common ancestor path for a list of paths.\n\n    parent [ [ 0, 1, 0, 1 ], [ 0, 1, 1, 0 ], [ 0, 1, 2, 3 ] ] == [ 0, 1 ]\n\n","type":"List.List (List.List Basics.Int) -> List.List Basics.Int"},{"name":"next","comment":" Increment last element of the path.\n\n    next [ 1, 2, 3 ] == [ 1, 2, 4 ]\n\n","type":"List.List Basics.Int -> List.List Basics.Int"},{"name":"parent","comment":" Obtain the parent path.\n\n    parent [ 1, 2, 3 ] == [ 1, 2 ]\n\n","type":"List.List Basics.Int -> List.List Basics.Int"}],"binops":[]},{"name":"RoseTree.Tree","comment":"\n\n@docs Tree\n\n\n# Create\n\n@docs branch, leaf\n\n\n# Traversing and updating\n\n@docs get, updateAt, replaceAt, removeAt, insertBefore, insertAfter\n\n\n# Properties\n\n@docs value, setValue, updateValue, getValueAt, updateValueAt\n\n\n# Children\n\n@docs children, unshift, push\n\n\n# Folds\n\n@docs map, mapValues, filterMap, foldl, foldr, findl, findr, any, all\n\n","unions":[{"name":"Tree","comment":" Represents a tree where each node contains a value of type `a`\nand an array of zero or more children.\n\n    tree : Tree String\n    tree =\n        Tree \"root\" (Array.fromList [ Tree \"a\" (Array.fromList []) ])\n\n","args":["a"],"cases":[["Tree",["a","Array.Array (RoseTree.Tree.Tree a)"]]]}],"aliases":[],"values":[{"name":"all","comment":" Checks if all nodes in the tree satisfy a predicate function.\n\n    all (\\n -> value n > 1) (branch 2 [ leaf 3, leaf 4 ]) == True\n\n","type":"(RoseTree.Tree.Tree a -> Basics.Bool) -> RoseTree.Tree.Tree a -> Basics.Bool"},{"name":"any","comment":" Checks if any node in the tree satisfies a predicate function.\n\n    any (\\n -> value n == \"b\") (branch \"root\" [ leaf \"a\", leaf \"b\" ]) == True\n\n","type":"(RoseTree.Tree.Tree a -> Basics.Bool) -> RoseTree.Tree.Tree a -> Basics.Bool"},{"name":"branch","comment":" Creates a branch node with the given value and children.\n\n    branch \"root\" [ leaf \"a\" ]\n        == Tree \"root\" (Array.fromList [ Tree \"a\" (Array.fromList []) ])\n\n","type":"a -> List.List (RoseTree.Tree.Tree a) -> RoseTree.Tree.Tree a"},{"name":"children","comment":" Retrieves the immediate children of a tree node.\n\n    children (branch \"root\" [ leaf \"a\", leaf \"b\" ])\n        == [ leaf \"a\", leaf \"b\" ]\n\n","type":"RoseTree.Tree.Tree a -> List.List (RoseTree.Tree.Tree a)"},{"name":"filterMap","comment":" Applies a filter and transformation function to each node in the tree. Nodes\nfor which the filter returns `Nothing` are removed, and nodes for which the\nfilter returns `Just` are replaced with the transformed value.\n\n    filterMap\n        (\\node ->\n            if value node == \"b\" then\n                Just (setValue \"x\" node)\n\n            else\n                Nothing\n        )\n        (branch \"root\" [ leaf \"a\", branch \"b\" [ leaf \"z\" ] ])\n        == branch \"root\" [ leaf \"x\" ]\n\n","type":"(RoseTree.Tree.Tree a -> Maybe.Maybe (RoseTree.Tree.Tree a)) -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"findl","comment":" Finds the first node in the tree that satisfies a predicate function\nstraring from the deepest leftmost node.\n\n     findl (\\n -> value n > 1) (branch 0 [ branch 1 [ leaf 0, leaf 2, leaf 3 ] ])\n         == Just (leaf 2)\n\n","type":"(RoseTree.Tree.Tree a -> Basics.Bool) -> RoseTree.Tree.Tree a -> Maybe.Maybe (RoseTree.Tree.Tree a)"},{"name":"findr","comment":" Finds the first node in the tree that satisfies a predicate function\nstraring from the deepest rightmost node.\n\n     findr (\\n -> value n > 1) (branch 0 [ branch 1 [ leaf 0, leaf 2, leaf 3 ] ])\n         == Just (leaf 3)\n\n","type":"(RoseTree.Tree.Tree a -> Basics.Bool) -> RoseTree.Tree.Tree a -> Maybe.Maybe (RoseTree.Tree.Tree a)"},{"name":"foldl","comment":" Reduces a tree from the deepest rightmost.\n\n     foldl (\\n acc -> value n ++ acc) \"\" (branch \"a\" [ leaf \"b\", leaf \"c\" ])\n         == \"cba\"\n\n","type":"(RoseTree.Tree.Tree a -> b -> b) -> b -> RoseTree.Tree.Tree a -> b"},{"name":"foldr","comment":" Reduces a tree from the deepest leftmost.\n\n     foldr (\\n acc -> value n ++ acc) \"\" (branch \"a\" [ leaf \"b\", leaf \"c\" ])\n         == \"bca\"\n\n","type":"(RoseTree.Tree.Tree a -> b -> b) -> b -> RoseTree.Tree.Tree a -> b"},{"name":"get","comment":" Retrieves a child node at the specified path.\n\n     get [ 1, 0 ] (branch \"root\" [ leaf \"a\", branch \"b\" [ leaf \"z\" ] ])\n         == Just (leaf \"z\")\n\n","type":"List.List Basics.Int -> RoseTree.Tree.Tree a -> Maybe.Maybe (RoseTree.Tree.Tree a)"},{"name":"getValueAt","comment":" Retrieves the value of a child node at the specified path.\n\n     getValueAt [ 1, 0 ] (branch \"root\" [ leaf \"a\", branch \"b\" [ leaf \"z\" ] ])\n         == Just \"z\"\n\n","type":"List.List Basics.Int -> RoseTree.Tree.Tree a -> Maybe.Maybe a"},{"name":"insertAfter","comment":" Inserts a new node after a child node at the specified path.\n\n    insertAfter [ 0 ] (leaf \"new\") (branch \"root\" [ leaf \"a\", leaf \"b\" ])\n        == branch \"root\" [ leaf \"a\", leaf \"new\", leaf \"b\" ]\n\n","type":"List.List Basics.Int -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"insertBefore","comment":" Inserts a new node before a child node at the specified path.\n\n    insertBefore [ 1 ] (leaf \"new\") (branch \"root\" [ leaf \"a\", leaf \"b\" ])\n        == branch \"root\" [ leaf \"a\", leaf \"new\", leaf \"b\" ]\n\n","type":"List.List Basics.Int -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"leaf","comment":" Creates a leaf node with the given value.\n\n     leaf 42 == Tree 42 (Array.fromList [])\n\n","type":"a -> RoseTree.Tree.Tree a"},{"name":"map","comment":" Applies a transformation function to each node in the tree.\n\n     map (updateValue ((+) 1)) (branch 0 [ leaf 1, branch 2 [ leaf 3 ] ])\n         == branch 1 [ branch 2 [], branch 3 [ leaf 4 ] ]\n\n","type":"(RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a) -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"mapValues","comment":" Applies a value transformation function to the values of each node in the\ntree.\n\n    mapValues ((*) 2) (branch 0 [ leaf 1, branch 2 [ leaf 3 ] ])\n        == branch 0 [ branch 2 [], branch 4 [ leaf 6 ] ]\n\n    map (updateValue ((*) 2)) (leaf 0) == mapValues ((*) 2) (leaf 0)\n\n","type":"(a -> b) -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree b"},{"name":"push","comment":" Adds a child node to the end of the children list of a parent node.\n\n    push (leaf \"b\") (branch \"root\" [ leaf \"a\" ])\n        == branch \"root\" [ leaf \"a\", leaf \"b\" ]\n\n","type":"RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"removeAt","comment":" Removes a child node at the specified path.\n\n    removeAt [ 1, 0 ]\n        (branch \"root\" [ leaf \"a\", branch \"b\" [ leaf \"z\" ] ])\n        == branch \"root\" [ leaf \"a\", leaf \"b\" ]\n\n","type":"List.List Basics.Int -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"replaceAt","comment":" Replaces a child node at the specified path with a new node if the node\nexists.\n\n    replaceAt [ 1 ] (leaf \"new\") (branch \"root\" [ leaf \"a\", leaf \"old\" ])\n        == branch \"root\" [ leaf \"a\", leaf \"new\" ]\n\n","type":"List.List Basics.Int -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"setValue","comment":" Sets the value of a tree node.\n\n     setValue \"new\" (leaf \"old\") == leaf \"new\"\n\n","type":"a -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"unshift","comment":" Adds a child node to the beginning of the children list of a parent node.\n\n    unshift (leaf \"b\") (branch \"root\" [ leaf \"a\" ])\n        == branch \"root\" [ leaf \"b\", leaf \"a\" ]\n\n","type":"RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"updateAt","comment":" Updates a child node at the specified path using a function if the node\nexists.\n\n    updateAt [ 1 ] (updateValue ((*) -1)) (branch 0 [ leaf 1, leaf 2 ])\n        == branch 0 [ leaf 1, leaf -2 ]\n\n","type":"List.List Basics.Int -> (RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a) -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"updateValue","comment":" Updates the value of a tree node using a function.\n\n     updateValue String.toUpper (leaf \"value\") == leaf \"VALUE\"\n\n","type":"(a -> a) -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"updateValueAt","comment":" Updates the value for a child node at the specified path using a function.\n\n    updateValueAt [ 1 ] String.toUpper (branch \"root\" [ leaf \"a\", leaf \"b\" ])\n        == branch \"root\" [ leaf \"a\", leaf \"B\" ]\n\n","type":"List.List Basics.Int -> (a -> a) -> RoseTree.Tree.Tree a -> RoseTree.Tree.Tree a"},{"name":"value","comment":" Retrieves the value of a tree node.\n\n     value (leaf \"leaf\") == \"leaf\"\n\n","type":"RoseTree.Tree.Tree a -> a"}],"binops":[]}]