gren-collections

A package of data-structures and funtions for generic collections for Gren.

Tree

Tree node is very simple tree to record parent-children relationships. You can store any type as a node. Since everything is keyed by ID, lookups, updates, and removals are straightforward. You can walk the tree depth-first from any starting node, find a node's parent, list all descendants, or fold over every node in the tree.

Tree.SingleRootTree

SingleRootTree node is a thin wrapper around Tree that helps you have one root node, and want to be able to reference the root without having to record the node ID yourself. You create it with a root node.

Use SingleRootTree when your data naturally has a single entry point and you want a more convenient API.