Module

Jack.Combinators

Package
purescript-jack
Repository
jystic/purescript-jack

#noShrink Source

noShrink :: forall a. Gen a -> Gen a

Prevent a 'Gen' from shrinking.

#sized Source

sized :: forall a. (Int -> Gen a) -> Gen a

Construct a 'Gen' that depends on the size parameter.

#resize Source

resize :: forall a. Int -> Gen a -> Gen a

Overrides the size parameter. Returns a 'Gen' which uses the given size

#scale Source

scale :: forall a. (Int -> Int) -> Gen a -> Gen a

Update the current size by mapping a function over it.

#chooseChar Source

chooseChar :: Char -> Char -> Gen Char

Generates a 'Char' in the given range.

#chooseInt Source

chooseInt :: Int -> Int -> Gen Int

Generates an integral number.

#boundedChar Source

boundedChar :: Gen Char

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

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

#frequency Source

frequency :: forall a. Array (Tuple Int (Gen a)) -> Gen a

Uses a weighted distribution to randomly select one of the jacks in the array.

#elements Source

elements :: forall a. Array a -> Gen a

Randomly selects one of the values in the array. /The input array must be non-empty./

#oneOf Source

oneOf :: forall a. Array (Gen a) -> Gen a

Randomly selects one of the jacks in the array. /The input array must be non-empty./

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

#listOf Source

listOf :: forall a. Gen a -> Gen (List a)

Generates a list of random length. The maximum length depends on the size parameter.

#listOf1 Source

listOf1 :: forall a. Gen a -> Gen (NonEmpty List a)

Generates a non-empty list of random length. The maximum length depends on the size parameter.

#listOfN Source

listOfN :: forall a. Int -> Gen a -> Gen (List a)

Generates a list of the given length.

#listOfN' Source

listOfN' :: forall a. Int -> Int -> Gen a -> Gen (List a)

Generates a list between 'n' and 'm' in length.

#arrayOf Source

arrayOf :: forall a. Gen a -> Gen (Array a)

Generates an array of random length. The maximum length depends on the size parameter.

#arrayOf1 Source

arrayOf1 :: forall a. Gen a -> Gen (NonEmpty Array a)

Generates a non-empty array of random length. The maximum length depends on the size parameter.

#arrayOfN Source

arrayOfN :: forall a. Int -> Gen a -> Gen (Array a)

Generates an array of the given length.

#arrayOfN' Source

arrayOfN' :: forall a. Int -> Int -> Gen a -> Gen (Array a)

Generates an array between 'n' and 'm' in length.

#maybeOf Source

maybeOf :: forall a. Gen a -> Gen (Maybe a)

Generates a 'Nothing' some of the time.

#justOf Source

justOf :: forall a. Gen (Maybe a) -> Gen a

Runs a generator that produces 'Maybe a' until it produces a 'Just'.

#suchThat Source

suchThat :: forall a. Gen a -> (a -> Boolean) -> Gen a

Generates a value that satisfies a predicate.

#suchThatMaybe Source

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

Tries to generate a value that satisfies a predicate.