upTo generates an integer between 0 (inclusive) and n.
Modulegenvalidity-1.1.1.0Haskell2010
Data.GenValidity.Utils
Contents
Synopsis
- value upTo
- value genSplit
- value genSplit3
- value genSplit4
- value genSplit5
- value genSplit6
- value genSplit7
- value genSplit8
- value arbPartition
- value shuffle
- value genListLength
- value genStringBy
- value genStringBy1
- value genListOf
- value genListOf1
- value genMaybe
- value genNonEmptyOf
- value genIntX
- value genWordX
- value genFloat
- value genDouble
- value genFloatX
- value genInteger
- value shrinkMaybe
- value shrinkTuple
- value shrinkTriple
- value shrinkQuadruple
- value shrinkT2
- value shrinkT3
- value shrinkT4
- value shrinkList
- value shrinkNonEmpty
- Packagegenvalidity-1.1.1.0
- Exports32
- LanguageHaskell2010
- LicenceMIT
- SourceUtils.hs
Helper functions for implementing generators
'genSplit a' generates a tuple '(b, c)' such that 'b + c' equals a.
'genSplit3 a' generates a triple '(b, c, d)' such that 'b + c + d' equals a.
'genSplit4 a' generates a quadruple '(b, c, d, e)' such that 'b + c + d + e' equals a.
'genSplit5 a' generates a quintuple '(b, c, d, e, f)' such that 'b + c + d + e + f' equals a.
'genSplit6 a' generates a sextuple '(b, c, d, e, f, g)' such that 'b + c + d + e + f + g' equals a.
'genSplit7 a' generates a septtuple '(b, c, d, e, f, g)' such that 'b + c + d + e + f + g' equals a.
'genSplit8 a' generates a octtuple '(b, c, d, e, f, g, h)' such that 'b + c + d + e + f + g + h' equals a.
'arbPartition n' generates a list ls such that 'sum ls' equals n, approximately.
Generates a random permutation of the given list.
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.
A version of genNonEmptyOf that returns a list instead of a NonEmpty.
Generate Int, Int8, Int16, Int32 and Int64 values smartly.
Some at the border
Some around zero
Mostly uniformly
Generate Word, Word8, Word16, Word32 and Word64 values smartly.
Some at the border
Some around zero
Mostly uniformly
See genFloatX
See genFloatX
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
Lift a shrinker function into a maybe
Combine two shrinking functions to shrink a tuple.
Like shrinkTuple, but for triples
Like shrinkTuple, but for quadruples
Turn a shrinking function into a function that shrinks tuples.
Turn a shrinking function into a function that shrinks triples.
Turn a shrinking function into a function that shrinks quadruples.
Shrink a list of values given a shrinking function for individual values.