hedgehog-1.2: Release with confidence.
Safe Haskell None
Language Haskell2010

Hedgehog.Internal.Tree

Synopsis

Documentation

pattern Tree :: NodeT Identity a -> Tree a Source #

Pattern to ease construction / deconstruction of pure trees.

newtype TreeT m a Source #

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

Constructors

TreeT

Fields

Instances

Instances details
Foldable Tree Source #
Instance details

Defined in Hedgehog.Internal.Tree

Traversable Tree Source #
Instance details

Defined in Hedgehog.Internal.Tree

MMonad TreeT Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

embed :: forall (n :: Type -> Type ) m b. Monad n => ( forall a. m a -> TreeT n a) -> TreeT m b -> TreeT n b Source #

MonadTrans TreeT Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

lift :: Monad m => m a -> TreeT m a Source #

MonadTransDistributive TreeT Source #
Instance details

Defined in Hedgehog.Internal.Tree

Associated Types

type Transformer f TreeT m Source #

Methods

distributeT :: forall f (m :: Type -> Type ) a. Transformer f TreeT m => TreeT (f m) a -> f ( TreeT m) a Source #

MonadBase b m => MonadBase b ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

liftBase :: b α -> TreeT m α Source #

MonadBaseControl b m => MonadBaseControl b ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Associated Types

type StM ( TreeT m) a Source #

MonadWriter w m => MonadWriter w ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

MonadState s m => MonadState s ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

MonadReader r m => MonadReader r ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

MonadError e m => MonadError e ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Monad m => Monad ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Functor m => Functor ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

fmap :: (a -> b) -> TreeT m a -> TreeT m b Source #

(<$) :: a -> TreeT m b -> TreeT m a Source #

Applicative m => Applicative ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Alternative m => Alternative ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Show1 m => Show1 ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Monad m => MonadZip ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

mzip :: TreeT m a -> TreeT m b -> TreeT m (a, b) Source #

mzipWith :: (a -> b -> c) -> TreeT m a -> TreeT m b -> TreeT m c Source #

munzip :: TreeT m (a, b) -> ( TreeT m a, TreeT m b) Source #

MonadIO m => MonadIO ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

MonadPlus m => MonadPlus ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

MonadCatch m => MonadCatch ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

catch :: Exception e => TreeT m a -> (e -> TreeT m a) -> TreeT m a Source #

MonadThrow m => MonadThrow ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

PrimMonad m => PrimMonad ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Associated Types

type PrimState ( TreeT m) Source #

MonadResource m => MonadResource ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

MFunctor TreeT Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

hoist :: forall m n (b :: k). Monad m => ( forall a. m a -> n a) -> TreeT m b -> TreeT n b Source #

( Eq1 m, Eq a) => Eq ( TreeT m a) Source #
Instance details

Defined in Hedgehog.Internal.Tree

( Show1 m, Show a) => Show ( TreeT m a) Source #
Instance details

Defined in Hedgehog.Internal.Tree

type Transformer f TreeT m Source #
Instance details

Defined in Hedgehog.Internal.Tree

type PrimState ( TreeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

type StM ( TreeT m) a Source #
Instance details

Defined in Hedgehog.Internal.Tree

type StM ( TreeT m) a = StM m ( NodeT m a)

mapTreeT :: (m ( NodeT m a) -> m ( NodeT m a)) -> TreeT m a -> TreeT m a Source #

Map between TreeT computations.

treeValue :: Tree a -> a Source #

The value at the root of the Tree .

treeChildren :: Tree a -> [ Tree a] Source #

The children of the Tree .

type Node = NodeT Identity Source #

A node in a rose tree.

pattern Node :: a -> [ Tree a] -> Node a Source #

Pattern to ease construction / deconstruction of pure nodes.

data NodeT m a Source #

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

Constructors

NodeT

Fields

Instances

Instances details
Foldable Node Source #
Instance details

Defined in Hedgehog.Internal.Tree

Traversable Node Source #
Instance details

Defined in Hedgehog.Internal.Tree

Monad m => Monad ( NodeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Functor m => Functor ( NodeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

fmap :: (a -> b) -> NodeT m a -> NodeT m b Source #

(<$) :: a -> NodeT m b -> NodeT m a Source #

Applicative m => Applicative ( NodeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

Show1 m => Show1 ( NodeT m) Source #
Instance details

Defined in Hedgehog.Internal.Tree

MFunctor NodeT Source #
Instance details

Defined in Hedgehog.Internal.Tree

Methods

hoist :: forall m n (b :: k). Monad m => ( forall a. m a -> n a) -> NodeT m b -> NodeT n b Source #

( Eq a, Eq1 m) => Eq ( NodeT m a) Source #
Instance details

Defined in Hedgehog.Internal.Tree

( Show1 m, Show a) => Show ( NodeT m a) Source #
Instance details

Defined in Hedgehog.Internal.Tree

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 n levels of a tree's children.

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

catMaybes :: Tree ( Maybe a) -> Maybe ( Tree a) Source #

Takes a tree of Maybe s and returns a tree of all the Just values.

If the root of the tree is Nothing then Nothing is returned.

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.

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

Returns a tree containing only elements that match the predicate.

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

depth :: Tree a -> Int Source #

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

interleave :: forall m a. Monad m => [ NodeT m a] -> NodeT m [a] Source #

renderT :: Monad m => TreeT m String -> m String Source #

Render a tree of strings, note that this forces all the delayed effects in the tree.