barecheck-0.2.0.8: QuickCheck implementations for common types

Safe HaskellSafe-Inferred
LanguageHaskell2010

Prelude.Generators

Description

Generators for Prelude types.

This module also contains function generators, like function1 and function2. These generate random functions. To use these, get a coarbitrary function from one of the modules whose name ends in Coarbitrary or by using the QuickCheck coarbitrary function, along with using a generator for the function's result type. For example:

   module MyModule where

   import Test.QuickCheck
   import qualified Prelude.Generators as G
   import qualified Data.Text.Coarbitrary as C
   import qualified Data.Text.Generators as G

   genTextToMaybeText :: Gen (Text -> Maybe Text)
   genTextToMaybeText = function1 C.text (G.maybe (G.text arbitrary))

Documentation

maybe :: Gen a -> Gen (Maybe a) Source

either :: Gen a -> Gen b -> Gen (Either a b) Source

function1 :: (a -> Gen b -> Gen b) -> Gen b -> Gen (a -> b) Source

function2 :: (a -> Gen r -> Gen r) -> (b -> Gen r -> Gen r) -> Gen r -> Gen (a -> b -> r) Source

function3 :: (a -> Gen r -> Gen r) -> (b -> Gen r -> Gen r) -> (c -> Gen r -> Gen r) -> Gen r -> Gen (a -> b -> c -> r) Source

function4 :: (a -> Gen r -> Gen r) -> (b -> Gen r -> Gen r) -> (c -> Gen r -> Gen r) -> (d -> Gen r -> Gen r) -> Gen r -> Gen (a -> b -> c -> d -> r) Source

function5 :: (a -> Gen r -> Gen r) -> (b -> Gen r -> Gen r) -> (c -> Gen r -> Gen r) -> (d -> Gen r -> Gen r) -> (e -> Gen r -> Gen r) -> Gen r -> Gen (a -> b -> c -> d -> e -> r) Source

tuple2 :: Gen a -> Gen b -> Gen (a, b) Source

tuple3 :: Gen a -> Gen b -> Gen c -> Gen (a, b, c) Source

tuple4 :: Gen a -> Gen b -> Gen c -> Gen d -> Gen (a, b, c, d) Source

tuple5 :: Gen a -> Gen b -> Gen c -> Gen d -> Gen e -> Gen (a, b, c, d, e) Source