# Jack.Tree

- Package
- purescript-jack
- Repository
- jystic/purescript-jack

### #Tree Source

`data Tree a`

A rose tree which represents a random generated outcome, and all the ways in which it can be made smaller.

This tree is exactly the same as 'Data.Tree' in every way except that Applicative '<*>' and Monad '>>=' walk the tree in the reverse order. This modification is critical for shrinking to reach a minimal counterexample.

#### Constructors

#### Instances

### #foldForest Source

`foldForest :: forall x b a. (a -> x -> b) -> (List b -> x) -> List (Tree a) -> x`

Fold over a list of trees.

### #unfoldTree Source

`unfoldTree :: forall b a. (b -> a) -> (b -> List b) -> b -> Tree a`

Build a 'Tree' from an unfolding function and a seed value.

### #unfoldForest Source

`unfoldForest :: forall b a. (b -> a) -> (b -> List b) -> b -> List (Tree a)`

Build a list of trees from an unfolding function and a seed value.

### #expandTree Source

`expandTree :: forall a. (a -> List a) -> Tree a -> Tree a`

Apply an additional unfolding function to an existing tree.

The root outcome remains intact, only the shrinks are affected, this applies recursively, so shrinks can only ever be added using this function.

If you want to replace the shrinks altogether, try:

unfoldTree f (outcome oldTree)