peterszerzo/elm-arborist/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Arborist.Tree

A tiny tiny tree module. Only a few utility methods are provided here - after all, if you want to manupilate the tree, you should probably do so using the interface 🤓.

Type

type Tree item
= Empty
| Node item (List (Tree item))

Recursive tree structure, holding any data type a, and any number of child nodes.

Json

decoder : Decoder item -> Decoder (Tree item)

Tree decoder as a function of the node's decoder. Assumes a value and children fields, holding the current node contents and an array of children, respectively.

Methods

depth : Tree item -> Int

Tree depth.

map : (a -> b) -> Tree a -> Tree b

Map over the items of the tree.