hedgehog-0.5.2: Hedgehog will eat all your bugs.

Safe HaskellNone
LanguageHaskell98

Hedgehog.Internal.Tree

Synopsis

Documentation

newtype Tree m a Source #

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

Constructors

Tree 

Fields

Instances

MMonad Tree Source # 

Methods

embed :: Monad n => (forall a. m a -> Tree n a) -> Tree m b -> Tree n b #

MonadTrans Tree Source # 

Methods

lift :: Monad m => m a -> Tree m a #

Distributive Tree Source # 

Associated Types

type Transformer (f :: (* -> *) -> * -> *) (Tree :: (* -> *) -> * -> *) (m :: * -> *) :: Constraint Source #

Methods

distribute :: Transformer f Tree m => Tree (f m) a -> f (Tree m) a Source #

MonadBase b m => MonadBase b (Tree m) Source # 

Methods

liftBase :: b α -> Tree m α #

MonadWriter w m => MonadWriter w (Tree m) Source # 

Methods

writer :: (a, w) -> Tree m a #

tell :: w -> Tree m () #

listen :: Tree m a -> Tree m (a, w) #

pass :: Tree m (a, w -> w) -> Tree m a #

MonadState s m => MonadState s (Tree m) Source # 

Methods

get :: Tree m s #

put :: s -> Tree m () #

state :: (s -> (a, s)) -> Tree m a #

MonadReader r m => MonadReader r (Tree m) Source # 

Methods

ask :: Tree m r #

local :: (r -> r) -> Tree m a -> Tree m a #

reader :: (r -> a) -> Tree m a #

MonadError e m => MonadError e (Tree m) Source # 

Methods

throwError :: e -> Tree m a #

catchError :: Tree m a -> (e -> Tree m a) -> Tree m a #

Monad m => Monad (Tree m) Source # 

Methods

(>>=) :: Tree m a -> (a -> Tree m b) -> Tree m b #

(>>) :: Tree m a -> Tree m b -> Tree m b #

return :: a -> Tree m a #

fail :: String -> Tree m a #

Functor m => Functor (Tree m) Source # 

Methods

fmap :: (a -> b) -> Tree m a -> Tree m b #

(<$) :: a -> Tree m b -> Tree m a #

Monad m => Applicative (Tree m) Source # 

Methods

pure :: a -> Tree m a #

(<*>) :: Tree m (a -> b) -> Tree m a -> Tree m b #

liftA2 :: (a -> b -> c) -> Tree m a -> Tree m b -> Tree m c #

(*>) :: Tree m a -> Tree m b -> Tree m b #

(<*) :: Tree m a -> Tree m b -> Tree m a #

Show1 m => Show1 (Tree m) Source # 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Tree m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Tree m a] -> ShowS #

MonadIO m => MonadIO (Tree m) Source # 

Methods

liftIO :: IO a -> Tree m a #

MonadPlus m => Alternative (Tree m) Source # 

Methods

empty :: Tree m a #

(<|>) :: Tree m a -> Tree m a -> Tree m a #

some :: Tree m a -> Tree m [a] #

many :: Tree m a -> Tree m [a] #

MonadPlus m => MonadPlus (Tree m) Source # 

Methods

mzero :: Tree m a #

mplus :: Tree m a -> Tree m a -> Tree m a #

MonadCatch m => MonadCatch (Tree m) Source # 

Methods

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

MonadThrow m => MonadThrow (Tree m) Source # 

Methods

throwM :: Exception e => e -> Tree m a #

PrimMonad m => PrimMonad (Tree m) Source # 

Associated Types

type PrimState (Tree m :: * -> *) :: * #

Methods

primitive :: (State# (PrimState (Tree m)) -> (#TupleRep [RuntimeRep], LiftedRep, State# (PrimState (Tree m)), a#)) -> Tree m a #

MonadResource m => MonadResource (Tree m) Source # 

Methods

liftResourceT :: ResourceT IO a -> Tree m a #

MFunctor * Tree Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> t m b -> t n b #

(Show1 m, Show a) => Show (Tree m a) Source # 

Methods

showsPrec :: Int -> Tree m a -> ShowS #

show :: Tree m a -> String #

showList :: [Tree m a] -> ShowS #

type Transformer f Tree m Source # 
type Transformer f Tree m = (Monad m, Monad (f m), Monad (Tree m), Monad (f (Tree m)), MonadTrans f, MFunctor * f)
type PrimState (Tree m) Source # 
type PrimState (Tree m) = PrimState m

data Node m a Source #

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

Constructors

Node 

Fields

Instances

Monad m => Monad (Node m) Source # 

Methods

(>>=) :: Node m a -> (a -> Node m b) -> Node m b #

(>>) :: Node m a -> Node m b -> Node m b #

return :: a -> Node m a #

fail :: String -> Node m a #

Functor m => Functor (Node m) Source # 

Methods

fmap :: (a -> b) -> Node m a -> Node m b #

(<$) :: a -> Node m b -> Node m a #

Monad m => Applicative (Node m) Source # 

Methods

pure :: a -> Node m a #

(<*>) :: Node m (a -> b) -> Node m a -> Node m b #

liftA2 :: (a -> b -> c) -> Node m a -> Node m b -> Node m c #

(*>) :: Node m a -> Node m b -> Node m b #

(<*) :: Node m a -> Node m b -> Node m a #

Show1 m => Show1 (Node m) Source # 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Node m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Node m a] -> ShowS #

MFunctor * Node Source # 

Methods

hoist :: Monad m => (forall a. m a -> n a) -> t m b -> t n b #

(Show1 m, Show a) => Show (Node m a) Source # 

Methods

showsPrec :: Int -> Node m a -> ShowS #

show :: Node m a -> String #

showList :: [Node m a] -> ShowS #

fromNode :: Applicative m => Node m a -> Tree m a Source #

Create a Tree from a Node

unfold :: Monad m => (a -> [a]) -> a -> Tree m a Source #

Create a tree from a value and an unfolding function.

unfoldForest :: Monad m => (a -> [a]) -> a -> [Tree m a] Source #

Create a forest from a value and an unfolding function.

expand :: Monad m => (a -> [a]) -> Tree m a -> Tree m a Source #

Expand a tree using an unfolding function.

prune :: Monad m => Tree m a -> Tree m a Source #

Throw away a tree's children.

render :: Monad m => Tree m String -> m String Source #

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