# Jack

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

## Re-exports from **Jack.**Combinators

### #suchThatMaybe Source

`suchThatMaybe :: forall a. Gen a -> (a -> Boolean) -> Gen (Maybe a)`

Tries to generate a value that satisfies a predicate.

### #oneOfRec Source

`oneOfRec :: forall a. Array (Gen a) -> Array (Gen a) -> Gen a`

Randomly selects from one of the jacks in either the non-recursive or the recursive array. When a selection is made from the recursive array, the size is halved. When the size gets to one or less, selections are no longer made from the recursive array. /The first argument (i.e. the non-recursive input array) must be non-empty./

### #boundedInt Source

`boundedInt :: Gen Int`

Generates an 'Int'. The number is chosen from the entire range of valid 'Int' values, this is [-2^31, 2^31).

### #boundedChar Source

`boundedChar :: Gen Char`

Generates a 'Char'. The character is chosen from the entire range of valid 'Char' values, this is [0, 65535].

## Re-exports from **Jack.**Gen

### #reshrinkLazy Source

`reshrinkLazy :: forall a. (a -> List a) -> Gen a -> Gen a`

Apply an additional shrinker to all generated trees.

## Re-exports from **Jack.**Property

### #renderResult Source

`renderResult :: Result -> String`

## Re-exports from **Jack.**Runner

## Re-exports from **Jack.**Shrink

### #shrinkTowards Source

`shrinkTowards :: forall a. Ord a => EuclideanRing a => a -> a -> List a`

Shrink an integral by edging towards a destination number.

### #shrinkList Source

`shrinkList :: forall a. List a -> List (List a)`

Produce a smaller permutation of the input list.

### #sequenceShrinkOne Source

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

Turn a list of trees in to a tree of lists, opting to shrink only the elements of the list (i.e. the size of the list will always be the same).

### #sequenceShrinkList Source

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

Turn a list of trees in to a tree of lists, opting to shrink both the list itself and the elements in the list during traversal.

### #halves Source

`halves :: forall a. Ord a => EuclideanRing a => a -> List a`

Produces a list containing the results of halving a number over and over again.

halves 30 == [30,15,7,3,1] halves 128 == [128,64,32,16,8,4,2,1] halves (-10) == [-10,-5,-2,-1]

## Re-exports from **Jack.**Tree

### #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

### #unfoldTree Source

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

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

### #unfoldForest Source

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

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

### #foldForest Source

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

Fold over a list of trees.

### #filterTree Source

`filterTree :: forall a. (a -> Boolean) -> Tree a -> Tree a`

Recursively discard any shrinks whose outcome does not pass the predicate. /Note that the root outcome can never be discarded./

### #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)