Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Tree = TreeT Identity
- pattern Tree :: NodeT Identity a -> Tree a
- newtype TreeT m a = TreeT {}
- runTree :: Tree a -> Node a
- mapTreeT :: (m (NodeT m a) -> m (NodeT m a)) -> TreeT m a -> TreeT m a
- treeValue :: Tree a -> a
- treeChildren :: Tree a -> [Tree a]
- type Node = NodeT Identity
- pattern Node :: a -> [Tree a] -> Node a
- data NodeT m a = NodeT {
- nodeValue :: a
- nodeChildren :: [TreeT m a]
- fromNodeT :: Applicative m => NodeT m a -> TreeT m a
- unfold :: Monad m => (a -> [a]) -> a -> TreeT m a
- unfoldForest :: Monad m => (a -> [a]) -> a -> [TreeT m a]
- expand :: Monad m => (a -> [a]) -> TreeT m a -> TreeT m a
- prune :: Monad m => Int -> TreeT m a -> TreeT m a
- catMaybes :: Tree (Maybe a) -> Maybe (Tree a)
- filter :: (a -> Bool) -> Tree a -> Maybe (Tree a)
- mapMaybe :: (a -> Maybe b) -> Tree a -> Maybe (Tree b)
- filterMaybeT :: (a -> Bool) -> TreeT (MaybeT Identity) a -> TreeT (MaybeT Identity) a
- mapMaybeMaybeT :: (a -> Maybe b) -> TreeT (MaybeT Identity) a -> TreeT (MaybeT Identity) b
- filterT :: (Monad m, Alternative m) => (a -> Bool) -> TreeT m a -> TreeT m a
- consChild :: Monad m => a -> TreeT m a -> TreeT m a
- mapMaybeT :: (Monad m, Alternative m) => (a -> Maybe b) -> TreeT m a -> TreeT m b
- depth :: Tree a -> Int
- interleave :: forall m a. Monad m => [NodeT m a] -> NodeT m [a]
- render :: Tree String -> String
- renderT :: Monad m => TreeT m String -> m String
Documentation
pattern Tree :: NodeT Identity a -> Tree a Source #
Pattern to ease construction / deconstruction of pure trees.
An effectful tree, each node in the tree can have an effect before it is produced.
Instances
mapTreeT :: (m (NodeT m a) -> m (NodeT m a)) -> TreeT m a -> TreeT m a Source #
Map between TreeT
computations.
pattern Node :: a -> [Tree a] -> Node a Source #
Pattern to ease construction / deconstruction of pure nodes.
A node in an effectful tree, as well as its unevaluated children.
Instances
Foldable Node Source # | |
Defined in Hedgehog.Internal.Tree fold :: Monoid m => Node m -> m # foldMap :: Monoid m => (a -> m) -> Node a -> m # foldMap' :: Monoid m => (a -> m) -> Node a -> m # foldr :: (a -> b -> b) -> b -> Node a -> b # foldr' :: (a -> b -> b) -> b -> Node a -> b # foldl :: (b -> a -> b) -> b -> Node a -> b # foldl' :: (b -> a -> b) -> b -> Node a -> b # foldr1 :: (a -> a -> a) -> Node a -> a # foldl1 :: (a -> a -> a) -> Node a -> a # elem :: Eq a => a -> Node a -> Bool # maximum :: Ord a => Node a -> a # | |
Traversable Node Source # | |
MFunctor NodeT Source # | |
Show1 m => Show1 (NodeT m) Source # | |
Applicative m => Applicative (NodeT m) Source # | |
Functor m => Functor (NodeT m) Source # | |
Monad m => Monad (NodeT m) Source # | |
(Show1 m, Show a) => Show (NodeT m a) Source # | |
(Eq a, Eq1 m) => Eq (NodeT m a) Source # | |
unfold :: Monad m => (a -> [a]) -> a -> TreeT m a Source #
Create a tree from a value and an unfolding function.
unfoldForest :: Monad m => (a -> [a]) -> a -> [TreeT m a] Source #
Create a forest from a value and an unfolding function.
expand :: Monad m => (a -> [a]) -> TreeT m a -> TreeT m a Source #
Expand a tree using an unfolding function.
prune :: Monad m => Int -> TreeT m a -> TreeT m a Source #
Throw away all but the top n
levels of a tree's children.
prune 0
will throw away all of a tree's children.
filter :: (a -> Bool) -> Tree a -> Maybe (Tree a) Source #
Returns a tree containing only elements that match the predicate.
If the root of the tree does not match the predicate then Nothing
is
returned.
filterMaybeT :: (a -> Bool) -> TreeT (MaybeT Identity) a -> TreeT (MaybeT Identity) a Source #
Returns a tree containing only elements that match the predicate.
If the root of the tree does not match the predicate then Nothing
is
returned.