Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

## Synopsis

- fromRange :: Random a => (a, a) -> FGen a
- pickAny :: Random a => FGen a
- suchThat :: FGen a -> (a -> Bool) -> FGen a
- suchThatMaybe :: FGen a -> (a -> Bool) -> FGen (Maybe a)
- oneof :: [FGen a] -> FGen a
- frequency :: [(Int, FGen a)] -> FGen a
- elements :: [a] -> FGen a
- sublistOf :: [a] -> FGen [a]
- shuffle :: [a] -> FGen [a]
- listUpTo :: Int -> FGen a -> FGen [a]
- listUpTo1 :: Int -> FGen a -> FGen [a]
- vectorOf :: Int -> FGen a -> FGen [a]
- infiniteListOf :: FGen a -> FGen [a]
- orderedList :: Ord a => Int -> FGen a -> FGen [a]
- fakeEnumFromTo :: Enum a => a -> a -> FGen a
- fakeEnum :: (Enum a, Bounded a) => FGen a
- fakeInt :: Int -> Int -> FGen Int
- fakeDouble :: Double -> Double -> FGen Double
- fakeDigit :: FGen Char
- fakeDigitNonzero :: FGen Char
- fakeLetter :: FGen Char
- fakeCapitalLetter :: FGen Char

## Common generators and combinators

fromRange :: Random a => (a, a) -> FGen a Source #

Generates a random element in the given inclusive range.

suchThatMaybe :: FGen a -> (a -> Bool) -> FGen (Maybe a) Source #

Tries to generate a value that satisfies a predicate.

oneof :: [FGen a] -> FGen a Source #

Randomly uses one of the given generators. The input list must be non-empty.

frequency :: [(Int, FGen a)] -> FGen a Source #

Chooses one of the given generators, with a weighted random distribution. The input list must be non-empty.

elements :: [a] -> FGen a Source #

Generates one of the given values. The input list must be non-empty.

listUpTo1 :: Int -> FGen a -> FGen [a] Source #

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

infiniteListOf :: FGen a -> FGen [a] Source #

Generates an infinite list.

fakeEnumFromTo :: Enum a => a -> a -> FGen a Source #

Generate a value of an enumeration in the range [from, to].

fakeEnum :: (Enum a, Bounded a) => FGen a Source #

Generate a value of an enumeration in the range [minBound, maxBound].

fakeDouble :: Double -> Double -> FGen Double Source #

`fakeEnumFromTo`

specialized to Int.

fakeLetter :: FGen Char Source #