Module

Test.StrongCheck.Gen

#GenT

newtype GenT f a

Constructors

Instances

#Gen

type Gen a = GenT Trampoline a

#GenState

newtype GenState

Constructors

Instances

#GenOut

newtype GenOut a

Constructors

Instances

#Size

type Size = Int

#allInArray

allInArray :: forall f a. Monad f => Array a -> GenT f a

A deterministic generator that produces values from the specified array, in sequence.

#allInRange

allInRange :: forall f. Monad f => Int -> Int -> GenT f Int

A deterministic generator that produces integers from the specified inclusive range, in sequence.

#applyGen

applyGen :: forall f a. Monad f => GenState -> GenT f a -> f (Maybe (GenOut (Tuple a (GenT f a))))

Applies a state to a generator to possibly produce the next state, a value, and the next generator.

#arrayOf

arrayOf :: forall f a. Monad f => GenT f a -> GenT f (Array a)

Creates a generator of elements ranging from 0 to the maximum size.

#arrayOf1

arrayOf1 :: forall f a. Monad f => GenT f a -> GenT f (Tuple a (Array a))

Creates a generator of elements ranging from 1 to the maximum size.

#charGen

charGen :: forall f. Monad f => GenT f Char

A generator for characters.

#choose

choose :: forall f. Monad f => Number -> Number -> GenT f Number

Creates a generator that generates real numbers between the specified inclusive range.

#chooseInt

chooseInt :: forall f. Monad f => Int -> Int -> GenT f Int

Creates a generator that generates integers between the specified inclusive range.

#chunked

chunked :: forall f a. Monad f => Int -> GenT f a -> GenT f (Array a)

Creates a generator that produces chunks of values in the specified size. Will extend the generator if necessary to produce a chunk of the specified size, but will not turn a finite generator into an infinite generator.

#collectAll

collectAll :: forall f a. Monad f => GenState -> GenT f a -> f (Array a)

Drains a finite generator of all values. Or blows up if you called it on an infinite generator.

#decorateSeed

decorateSeed :: forall f a. Monad f => GenT f a -> GenT f (Tuple Seed a)

#dropGen

dropGen :: forall f a. Monad f => Int -> GenT f a -> GenT f a

Drops a certain number of values from the generator. May produce an empty generator if called on a finite generator.

#elements

elements :: forall f a. Monad f => a -> List a -> GenT f a

Creates a generator that chooses an element from among a set of elements.

#extend

extend :: forall f a. Monad f => Int -> GenT f a -> GenT f a

Extends a generator to produce at least the specified number of values. Will not turn a finite generator into an infinite one.

#foldGen

foldGen :: forall f a b. Monad f => (b -> a -> Maybe b) -> b -> GenState -> GenT f a -> f b

Folds over a generator to produce a value. Either the generator or the user-defined function may halt the fold.

#foldGen'

foldGen' :: forall f a b. Monad f => (b -> a -> Maybe b) -> b -> GenState -> GenT f a -> f (Tuple b (GenT f a))

Folds over a generator to produce a value. Either the generator or the user-defined function may halt the fold. Returns not just the value created through folding, but also the successor generator.

#frequency

frequency :: forall f a. Monad f => Tuple Number (GenT f a) -> List (Tuple Number (GenT f a)) -> GenT f a

Generates elements by the specified frequencies (which will be normalized).

#infinite

infinite :: forall f a. Monad f => GenT f a -> GenT f a

Ensures that a given generator can produce an infinite number of values, assuming it can produce at least one.

#interleave

interleave :: forall f a. Monad f => GenT f a -> GenT f a -> GenT f a

Fairly interleaves two generators.

#nChooseK

nChooseK :: forall f a. Monad f => Int -> Array a -> GenT f (Array a)

A deterministic generator that produces all possible combinations of choosing exactly k elements from the specified array.

#oneOf

oneOf :: forall f a. Monad f => GenT f a -> Array (GenT f a) -> GenT f a

Creates a generator that chooses another generator from the specified list at random, and then generates a value with that generator.

#perms

perms :: forall f a. Monad f => Array a -> GenT f (Array a)

A deterministic generator that produces all possible permutations of the specified array.

#perturbGen

perturbGen :: forall f a. Monad f => Number -> GenT f a -> GenT f a

#repeatable

repeatable :: forall a b. (a -> Gen b) -> Gen (a -> b)

Creates a function generator that will always generate the same output for the same input.

#resize

resize :: forall f a. Monad f => Size -> GenT f a -> GenT f a

Resizes the generator so the size parameter passed into the generator will be equal to the specified size.

#runGen

runGen :: forall f a. Monad f => Int -> GenState -> GenT f a -> f (Tuple (Array a) (GenT f a))

Runs a generator to produce a specified number of values, returning both an array containing the values and the successor Gen that can be used to continue the generation process at a later time.

#sample

sample :: forall f a. Monad f => Int -> GenT f a -> f (Array a)

Samples a generator, producing the specified number of values. Uses default settings for the initial generator state.

#sample'

sample' :: forall f a. Monad f => Int -> GenState -> GenT f a -> f (Array a)

Samples a generator, producing the specified number of values.

#showSample

showSample :: forall a. Show a => Gen a -> Effect Unit

Shows a sample of values generated from the specified generator.

#showSample'

showSample' :: forall a. Show a => Int -> Gen a -> Effect Unit

Shows a sample of values generated from the specified generator.

#shuffle

shuffle :: forall f a. Monad f => GenT f a -> GenT f a

Same as shuffle' but with default for the chunk size.

#shuffle'

shuffle' :: forall f a. Monad f => Int -> GenT f a -> GenT f a

Creates a generator that mixes up the order of the specified generator. This is achieved by chunking the generator with the specified size and then shuffling each chunk before continuing to the next.

#shuffleArray

shuffleArray :: forall f a. Monad f => Array a -> GenT f (Array a)

Creates a generator that produces shuffled versions of the provided array.

#sized

sized :: forall f a. Monad f => (Size -> GenT f a) -> GenT f a

Creates a generator that depends on the size parameter.

#stateful

stateful :: forall f a. Monad f => (GenState -> GenT f a) -> GenT f a

Creates a generator that depends on access to the generator state.

#suchThat

suchThat :: forall f a. Monad f => GenT f a -> (a -> Boolean) -> GenT f a

Filters a generator to produce only values satisfying the specified predicate.

#suchThatMaybe

suchThatMaybe :: forall f a. Monad f => GenT f a -> (a -> Boolean) -> GenT f (Maybe a)

Tries to filter a generator such that it only produces values satisfying the specified predicate.

#takeGen

takeGen :: forall f a. Monad f => Int -> GenT f a -> GenT f a

Takes the first number of values from the generator. Will turn an infinite generator into a finite generator.

#toLazyList

toLazyList :: forall a. Gen a -> GenState -> ListT Lazy a

Converts the generator into a function that, given the initial state, returns a lazy list.

#transGen

transGen :: forall f a b c. Monad f => (b -> a -> Tuple b (Maybe c)) -> b -> GenT f a -> GenT f c

Transforms one gen into another, passing along user-supplied state. Either the generator being transformed or the transforming function may halt the transformation.

#uniform

uniform :: forall f. Monad f => GenT f Number

#unGen

unGen :: forall f a. GenT f a -> MealyT f GenState (GenOut a)

#unGenOut

unGenOut :: forall a. GenOut a -> { state :: GenState, value :: a }

#unGenState

unGenState :: GenState -> { seed :: Seed, size :: Size }

#updateSeedState

#variant

variant :: forall f a. Monad f => Seed -> GenT f a -> GenT f a

Fixes a generator on a certain variant, given by the specified seed.

#vectorOf

vectorOf :: forall f a. Monad f => Int -> GenT f a -> GenT f (Array a)

Creates a generator that generates arrays of some specified size.

#wrapEffect

wrapEffect :: forall f a. Monad f => f a -> GenT f a

Wraps an effect in a generator that ignores the input state.

Modules