planet-mitchell-0.0.0: Planet Mitchell

Safe HaskellSafe
LanguageHaskell2010

Tree

Contents

Synopsis

Documentation

module Data.Tree

postorder :: Tree a -> [a] #

Flatten a Tree, returning the elements in post-order.

postorderF :: [Tree a] -> [a] #

Flatten multiple Trees in post-order.

preorder :: Tree a -> [a] #

Flatten a Tree, returning the elements in pre-order. Equivalent to flatten in Tree.

preorderF :: [Tree a] -> [a] #

Flatten multiple Trees in pre-order.

Optics

root :: Functor f => (a -> f a) -> Tree a -> f (Tree a) #

A Lens that focuses on the root of a Tree.

>>> view root $ Node 42 []
42

branches :: Functor f => ([Tree a] -> f [Tree a]) -> Tree a -> f (Tree a) #

A Lens returning the direct descendants of the root of a Tree

view branchessubForest