hledger-lib-0.27: Core data types, parsers and functionality for the hledger accounting tools

Safe HaskellNone
LanguageHaskell2010

Hledger.Utils.Tree

Synopsis

Documentation

root :: Tree a -> a Source

leaves :: Tree a -> [a] Source

List just the leaf nodes of a tree

subtreeat :: Eq a => a -> Tree a -> Maybe (Tree a) Source

get the sub-tree rooted at the first (left-most, depth-first) occurrence of the specified node value

subtreeinforest :: Eq a => a -> [Tree a] -> Maybe (Tree a) Source

get the sub-tree for the specified node value in the first tree in forest in which it occurs.

treeprune :: Int -> Tree a -> Tree a Source

remove all nodes past a certain depth

treemap :: (a -> b) -> Tree a -> Tree b Source

apply f to all tree nodes

treefilter :: (a -> Bool) -> Tree a -> Tree a Source

remove all subtrees whose nodes do not fulfill predicate

treeany :: (a -> Bool) -> Tree a -> Bool Source

is predicate true in any node of tree ?

showtree :: Show a => Tree a -> String Source

show a compact ascii representation of a tree

showforest :: Show a => Forest a -> String Source

show a compact ascii representation of a forest

newtype FastTree a Source

An efficient-to-build tree suggested by Cale Gibbard, probably better than accountNameTreeFrom.

Constructors

T (Map a (FastTree a)) 

Instances

Eq a => Eq (FastTree a) Source 
Ord a => Ord (FastTree a) Source 
Show a => Show (FastTree a) Source 

treeFromPaths :: Ord a => [[a]] -> FastTree a Source