-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A simple multi-way tree data structure. -- -- In some contexts, forests (collections of zero or more trees) are more -- important than trees. The data-forest library provides a -- Tree type much like the one from the popular -- containers library, but it also provides a Forest type -- with its own Functor and Foldable instances. @package data-forest @version 0.1.0.2 -- | Multi-way trees (also known as rose trees) and forests, similar -- to Data.Tree from the popular containers library. module Data.Forest -- | A forest is defined completely by its trees. -- -- To construct a forest, use forest or leaves. data Forest a -- | A tree is defined completely by its root and its -- subforest. -- -- To construct a tree, use tree or leaf. data Tree a -- | Construct a forest from a list of trees. -- -- forest [] is equivalent to mempty. forest :: [Tree a] -> Forest a -- | Construct a tree with a root and subforest. tree :: a -> Forest a -> Tree a -- | Construct a tree with a single root and no subforest. -- -- leaf x is equivalent to tree x -- mempty. leaf :: a -> Tree a -- | Construct a forest of depth 1, where each tree contains only a root. -- -- leaves is equivalent to forest . fmap -- leaf leaves :: [a] -> Forest a -- | The trees that constitute the forest. trees :: Forest a -> [Tree a] -- | The value at the root node of the tree. root :: Tree a -> a -- | The forest containing all descendants of the tree's root. subforest :: Tree a -> Forest a -- | The tree's immediate subtrees. -- -- subtrees is equivalent to trees . -- subforest. subtrees :: Tree a -> [Tree a] instance GHC.Base.Monoid (Data.Forest.Forest a) instance Data.Semigroup.Semigroup (Data.Forest.Forest a) instance GHC.Base.Functor Data.Forest.Forest instance Data.Foldable.Foldable Data.Forest.Forest instance GHC.Show.Show a => GHC.Show.Show (Data.Forest.Forest a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Forest.Forest a) instance GHC.Base.Functor Data.Forest.Tree instance Data.Foldable.Foldable Data.Forest.Tree instance GHC.Show.Show a => GHC.Show.Show (Data.Forest.Tree a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Forest.Tree a)