acme-circular-containers-0.1.0.0: Spineless containers which are fast to read but inefficient to update

Data.Tree.Circular

Synopsis

# Documentation

data TreeNode a Source #

A variant of Tree in which we can walk from the root towards the leaves, as usual, but also from a leaf towards the root.

Trees are not typically represented this way because the cycles between each node and its parent mean that any change to the tree requires reallocating all of its node, not just the path from the root to the modified element. For this reason, we do not offer any update operations.

Constructors

 TreeNode FieldstreeNodeParent :: Maybe (TreeNode a) treeNodeLabel :: a treeNodeChildren :: [TreeNode a]

freeze :: forall a. Tree a -> TreeNode a Source #

Returns the root TreeNode. O(n)

thaw :: TreeNode a -> Tree a Source #

Returns the Tree rooted at the given TreeNode. O(n)