Copyright | (c) Alexandre Moine 2019 |
---|---|
Maintainer | alexandre@moine.me |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Tungsten.Structure.Tree
Description
This module defines a type isomorphic to binary trees, in terms of Fix
from
Tungsten.Fix.
A good consumer is a function that can be fused with a good producer. A good producer is a function that can be fused with a good consumer.
Binary trees as fixed-points
The "factored-out" recursive type for binary trees.
Instances
Eq2 TreeF Source # | |
Show2 TreeF Source # | |
Functor (TreeF a) Source # | |
Eq a => Eq1 (TreeF a) Source # | |
Show a => Show1 (TreeF a) Source # | |
(Eq a, Eq b) => Eq (TreeF a b) Source # | |
(Ord a, Ord b) => Ord (TreeF a b) Source # | |
(Read a, Read b) => Read (TreeF a b) Source # | |
(Show a, Show b) => Show (TreeF a b) Source # | |
Binary trees expressed as a fixed-point.
Operations on trees
hasLeaf :: Eq a => a -> Tree a -> Bool Source #
hasLeaf s t
tests if the leaf s
is present in the tree t
.
Good consumer.
Conversions
treeFromList :: [Tree a] -> Tree a Source #
Construct a binary tree from a list. Good consumer (of Prelude lists) and good producer (of trees).