HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehedgehog-1.7Haskell2010

Hedgehog.Internal.Tree

  • 4 types
  • 21 values
  • Packagehedgehog-1.7
  • Exports27
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTree.hs
patternpattern Tree :: NodeT Identity a -> Tree a
#

Pattern to ease construction / deconstruction of pure trees.

newtypenewtype TreeT (m :: Type -> Type) a
#

An effectful tree, each node in the tree can have an effect before it is produced.

Constructors

Instances29Foldable, Traversable, MonadTrans, MMonad, MonadTransDistributive, MFunctor, …
patternpattern Node :: a -> [Tree a] -> Node a
#

Pattern to ease construction / deconstruction of pure nodes.

datadata NodeT (m :: Type -> Type) a
#

A node in an effectful tree, as well as its unevaluated children.

Constructors

Instances9Foldable, Traversable, MFunctor, Monad, Functor, Applicative, …
valueunfold :: Monad m => (a -> [a]) -> a -> TreeT m a
#

Create a tree from a value and an unfolding function.

valueunfoldForest :: Monad m => (a -> [a]) -> a -> [TreeT m a]
#

Create a forest from a value and an unfolding function.

valueexpand :: Monad m => (a -> [a]) -> TreeT m a -> TreeT m a
#

Expand a tree using an unfolding function.

valueprune :: Monad m => Int -> TreeT m a -> TreeT m a
#

Throw away all but the top n levels of a tree's children.

prune 0 will throw away all of a tree's children.

valuefilter :: (a -> Bool) -> Tree a -> Maybe (Tree a)
#

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.

valuefilterT :: (Monad m, Alternative m) => (a -> Bool) -> TreeT m a -> TreeT m a
#

Returns a tree containing only elements that match the predicate.

When an element does not match the predicate its node is replaced with empty.

valuedepth :: Tree a -> Int
#

Returns the depth of the deepest leaf node in the tree.