HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Helper functions for implementing generators

valueshuffle :: [a] -> Gen [a]

Generates a random permutation of the given list.

valuegenListOf :: Gen a -> Gen [a]

A version of listOf that takes size into account more accurately.

This generator distributes the size that is is given among the values in the list that it generates.

valuegenFloatX :: (Read a, RealFloat a, Bounded w, Random w) => (w -> a) -> Gen a

Generate floating point numbers smartly:

  • Some denormalised

  • Some around zero

  • Some around the bounds

  • Some by encoding an Integer and an Int to a floating point number.

  • Some accross the entire range

  • Mostly uniformly via the bitrepresentation

The function parameter is to go from the bitrepresentation to the floating point value.

Helper functions for implementing shrinking functions

valueshrinkTuple :: (a -> [a]) -> (b -> [b]) -> (a, b) -> [(a, b)]

Combine two shrinking functions to shrink a tuple.

valueshrinkT2 :: (a -> [a]) -> (a, a) -> [(a, a)]

Turn a shrinking function into a function that shrinks tuples.

valueshrinkT3 :: (a -> [a]) -> (a, a, a) -> [(a, a, a)]

Turn a shrinking function into a function that shrinks triples.

valueshrinkT4 :: (a -> [a]) -> (a, a, a, a) -> [(a, a, a, a)]

Turn a shrinking function into a function that shrinks quadruples.

valueshrinkList :: (a -> [a]) -> [a] -> [[a]]

Shrink a list of values given a shrinking function for individual values.