tomjkidd/elm-multiway-tree-zipper/1.5.0

NOTE: this package is not compatible with Elm 0.19.1

MultiwayTree

A library for constructing multi-way trees. Each Tree carries two pieces of information, it's datum and children.

Types

type Tree a
= Tree a (Forest a)

A type to keep track of datum and children.

type alias Forest a =
List (Tree a)

A list of Trees. Convenient for describing children.

Operations

datum : Tree a -> a

Access the datum of the current tree

children : Tree a -> Forest a

Access the children of the current tree

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

Reduce a Tree from the left.

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

Reduce a Tree from the right.

flatten : Tree a -> List a

Flattens a Tree into a List where the root is the first element of that list.

filter : (a -> Bool) -> Tree a -> Maybe (Tree a)

Filter the MultiwayTree. Keep only elements whose datum satisfy the predicate.

filterWithChildPrecedence : (a -> Bool) -> Tree a -> Maybe (Tree a)

Filter the MultiwayTree. If the predicate is True for a Child the entire path to the root will be part of the result Tree.

Mapping

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

Map over the MultiwayTree