-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Safe reimplementation of QuickCheck's core
--   
--   QuickCheck-safe reimplements the quickCheck functionality with a pure
--   interface and a very small trusted base (see
--   Test.QuickCheck.Safe.Trusted).
--   
--   <ul>
--   <li>uses the existing Arbitrary instances</li>
--   <li>implemented features: testing, result minimization (i.e.,
--   shrinking)</li>
--   <li>missing features: expected failures, label frequencies,
--   coverage</li>
--   </ul>
--   
--   The package is targeted at users who want to leverage SafeHaskell for
--   sandboxing.
--   
--   <pre>
--   &gt;&gt;&gt; putStr $ quickCheck (inventQCGen ()) (\x -&gt; length (x :: [()]) &lt; 10)
--   *** Failed! Falsifiable (after 18 tests and 3 shrinks):
--   [(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]
--   </pre>
@package QuickCheck-safe
@version 0.1.0.4

module Test.QuickCheck.Safe.Trusted

-- | <a>pureEvaluate</a> wraps <a>tryEvaluate</a> in
--   <a>unsafePerformIO</a>. This may look like a dirty hack, but this
--   building block allows us to implement most of QuickCheck's
--   functionality without resorting to IO again.
pureEvaluate :: a -> Either AnException a
type AnException = SomeException

-- | <a>inventQCGen</a> invokes <a>newQCGen</a> via <a>unsafePerformIO</a>.
--   It is useful in connection with the <a>quickCheck</a> family of
--   functions.
inventQCGen :: a -> QCGen

-- | The "standard" QuickCheck random number generator. A wrapper around
--   either <a>TFGen</a> on GHC, or <a>StdGen</a> on other Haskell systems.
data QCGen


-- | This module implements a simplified, pure version of Test.Quickcheck's
--   quickCheck functionality.
module Test.QuickCheck.Safe

-- | Cf. <a>quickCheck</a>. Note that in contrast to QuickCheck's function,
--   this one takes an additional <a>QCGen</a> argument.
--   
--   <pre>
--   &gt;&gt;&gt; putStr $ quickCheck (inventQCGen ()) (\x -&gt; length (x :: [()]) &lt; 10)
--   *** Failed! Falsifiable (after 18 tests and 3 shrinks):
--   [(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]
--   </pre>
quickCheck :: STestable prop => QCGen -> prop -> String

-- | Cf. <a>quickCheckResult</a>. Note that in contrast to QuickCheck's
--   function, this one takes an additional <a>QCGen</a> argument.
quickCheckResult :: STestable prop => QCGen -> prop -> Result

-- | Cf. <a>quickCheckWith</a>. Note that in contrast to QuickCheck's
--   function, this one takes an additional <a>QCGen</a> argument.
quickCheckWith :: STestable prop => Args -> QCGen -> prop -> String

-- | Cf. <a>quickCheckWithResult</a>. Note that in contrast to QuickCheck's
--   function, this one takes an additional <a>QCGen</a> argument.
quickCheckWithResult :: STestable prop => Args -> QCGen -> prop -> Result
class STestable prop

-- | Implication. Cf. <a>==&gt;</a>.
(==>) :: STestable prop => Bool -> prop -> SProperty

-- | Disjunction. Cf. <a>.||.</a>.
(.||.) :: (STestable prop2, STestable prop1) => prop1 -> prop2 -> SProperty

-- | Conjunction. Cf. <a>.&amp;&amp;.</a>.
(.&&.) :: (STestable prop2, STestable prop1) => prop1 -> prop2 -> SProperty

-- | Nondeterministic conjunction. Cf. <a>&amp;.</a>.
(.&.) :: (STestable prop2, STestable prop1) => prop1 -> prop2 -> SProperty

-- | Equality test. Cf. <a>===</a>.
(===) :: (Eq a, Show a) => a -> a -> SProperty

-- | Label tests. Cf. <a>label</a>.
label :: STestable prop => String -> prop -> SProperty

-- | Shrink counterexamples. Cf. <a>shrinking</a>.
shrinking :: STestable prop => (a -> [a]) -> a -> (a -> prop) -> SProperty

-- | Suppress shrinking of counterexamples. Cf. <a>noShrinking</a>.
noShrinking :: STestable prop => prop -> SProperty

-- | Adjust testcase sizes. Cf. <a>mapSize</a>.
mapSize :: STestable prop => (Int -> Int) -> prop -> SProperty

-- | Universal quantification. Cf. <a>forAll</a>.
forAll :: (Show a, STestable prop) => Gen a -> (a -> prop) -> SProperty

-- | Universal quantification with shrinking. Cf. <a>forAllShrink</a>.
forAllShrink :: (Show a, STestable prop) => Gen a -> (a -> [a]) -> (a -> prop) -> SProperty

-- | <a>inventQCGen</a> invokes <a>newQCGen</a> via <a>unsafePerformIO</a>.
--   It is useful in connection with the <a>quickCheck</a> family of
--   functions.
inventQCGen :: a -> QCGen

-- | Test all properties in the current module. This is just a convenience
--   function that combines <a>quickCheckAll</a> and <a>verbose</a>.
--   
--   <a>verboseCheckAll</a> has the same issue with scoping as
--   <a>quickCheckAll</a>: see the note there about <tt>return []</tt>.
verboseCheckAll :: Q Exp

-- | Test all properties in the current module. The name of the property
--   must begin with <tt>prop_</tt>. Polymorphic properties will be
--   defaulted to <a>Integer</a>. Returns <a>True</a> if all tests
--   succeeded, <a>False</a> otherwise.
--   
--   To use <a>quickCheckAll</a>, add a definition to your module along the
--   lines of
--   
--   <pre>
--   return []
--   runTests = $quickCheckAll
--   </pre>
--   
--   and then execute <tt>runTests</tt>.
--   
--   Note: the bizarre <tt>return []</tt> in the example above is needed on
--   GHC 7.8 and later; without it, <a>quickCheckAll</a> will not be able
--   to find any of the properties. For the curious, the <tt>return []</tt>
--   is a Template Haskell splice that makes GHC insert the empty list of
--   declarations at that point in the program; GHC typechecks everything
--   before the <tt>return []</tt> before it starts on the rest of the
--   module, which means that the later call to <a>quickCheckAll</a> can
--   see everything that was defined before the <tt>return []</tt>. Yikes!
quickCheckAll :: Q Exp

-- | List all properties in the current module.
--   
--   <tt>$<a>allProperties</a></tt> has type <tt>[(<a>String</a>,
--   <a>Property</a>)]</tt>.
--   
--   <a>allProperties</a> has the same issue with scoping as
--   <a>quickCheckAll</a>: see the note there about <tt>return []</tt>.
allProperties :: Q Exp

-- | Test all properties in the current module, using a custom
--   <a>quickCheck</a> function. The same caveats as with
--   <a>quickCheckAll</a> apply.
--   
--   <tt>$<a>forAllProperties</a></tt> has type <tt>(<a>Property</a> -&gt;
--   <a>IO</a> <a>Result</a>) -&gt; <a>IO</a> <a>Bool</a></tt>. An example
--   invocation is <tt>$<a>forAllProperties</a>
--   <a>quickCheckResult</a></tt>, which does the same thing as
--   <tt>$<a>quickCheckAll</a></tt>.
--   
--   <a>forAllProperties</a> has the same issue with scoping as
--   <a>quickCheckAll</a>: see the note there about <tt>return []</tt>.
forAllProperties :: Q Exp

-- | Monomorphise an arbitrary property by defaulting all type variables to
--   <a>Integer</a>.
--   
--   For example, if <tt>f</tt> has type <tt><a>Ord</a> a =&gt; [a] -&gt;
--   [a]</tt> then <tt>$(<a>monomorphic</a> 'f)</tt> has type
--   <tt>[<a>Integer</a>] -&gt; [<a>Integer</a>]</tt>.
--   
--   If you want to use <a>monomorphic</a> in the same file where you
--   defined the property, the same scoping problems pop up as in
--   <a>quickCheckAll</a>: see the note there about <tt>return []</tt>.
monomorphic :: Name -> ExpQ

-- | Test a polymorphic property, defaulting all type variables to
--   <a>Integer</a>. This is just a convenience function that combines
--   <a>verboseCheck</a> and <a>monomorphic</a>.
--   
--   If you want to use <a>polyVerboseCheck</a> in the same file where you
--   defined the property, the same scoping problems pop up as in
--   <a>quickCheckAll</a>: see the note there about <tt>return []</tt>.
polyVerboseCheck :: Name -> ExpQ

-- | Test a polymorphic property, defaulting all type variables to
--   <a>Integer</a>.
--   
--   Invoke as <tt>$(<a>polyQuickCheck</a> 'prop)</tt>, where <tt>prop</tt>
--   is a property. Note that just evaluating <tt><a>quickCheck</a>
--   prop</tt> in GHCi will seem to work, but will silently default all
--   type variables to <tt>()</tt>!
--   
--   <tt>$(<a>polyQuickCheck</a> 'prop)</tt> means the same as
--   <tt><a>quickCheck</a> $(<a>monomorphic</a> 'prop)</tt>. If you want to
--   supply custom arguments to <a>polyQuickCheck</a>, you will have to
--   combine <a>quickCheckWith</a> and <a>monomorphic</a> yourself.
--   
--   If you want to use <a>polyQuickCheck</a> in the same file where you
--   defined the property, the same scoping problems pop up as in
--   <a>quickCheckAll</a>: see the note there about <tt>return []</tt>.
polyQuickCheck :: Name -> ExpQ

-- | Tests a property, using test arguments, produces a test result, and
--   prints the results and all test cases generated to <tt>stdout</tt>.
--   This is just a convenience function that combines
--   <a>quickCheckWithResult</a> and <a>verbose</a>.
verboseCheckWithResult :: Testable prop => Args -> prop -> IO Result

-- | Tests a property, produces a test result, and prints the results and
--   all test cases generated to <tt>stdout</tt>. This is just a
--   convenience function that combines <a>quickCheckResult</a> and
--   <a>verbose</a>.
verboseCheckResult :: Testable prop => prop -> IO Result

-- | Tests a property, using test arguments, and prints the results and all
--   test cases generated to <tt>stdout</tt>. This is just a convenience
--   function that combines <a>quickCheckWith</a> and <a>verbose</a>.
verboseCheckWith :: Testable prop => Args -> prop -> IO ()

-- | Tests a property and prints the results and all test cases generated
--   to <tt>stdout</tt>. This is just a convenience function that means the
--   same as <tt><a>quickCheck</a> . <a>verbose</a></tt>.
verboseCheck :: Testable prop => prop -> IO ()

-- | The default test arguments
stdArgs :: Args

-- | Args specifies arguments to the QuickCheck driver
data Args
Args :: Maybe (QCGen, Int) -> Int -> Int -> Int -> Bool -> Int -> Args

-- | Should we replay a previous test? Note: saving a seed from one version
--   of QuickCheck and replaying it in another is not supported. If you
--   want to store a test case permanently you should save the test case
--   itself.
[replay] :: Args -> Maybe (QCGen, Int)

-- | Maximum number of successful tests before succeeding. Testing stops at
--   the first failure. If all tests are passing and you want to run more
--   tests, increase this number.
[maxSuccess] :: Args -> Int

-- | Maximum number of discarded tests per successful test before giving up
[maxDiscardRatio] :: Args -> Int

-- | Size to use for the biggest test cases
[maxSize] :: Args -> Int

-- | Whether to print anything
[chatty] :: Args -> Bool

-- | Maximum number of shrinks to before giving up. Setting this to zero
--   turns shrinking off.
[maxShrinks] :: Args -> Int

-- | Result represents the test result
data Result

-- | A successful test run
Success :: Int -> [(String, Double)] -> String -> Result

-- | Number of tests performed
[numTests] :: Result -> Int

-- | Labels and frequencies found during all successful tests
[labels] :: Result -> [(String, Double)]

-- | Printed output
[output] :: Result -> String

-- | Given up
GaveUp :: Int -> [(String, Double)] -> String -> Result

-- | Number of tests performed
[numTests] :: Result -> Int

-- | Labels and frequencies found during all successful tests
[labels] :: Result -> [(String, Double)]

-- | Printed output
[output] :: Result -> String

-- | A failed test run
Failure :: Int -> Int -> Int -> Int -> QCGen -> Int -> String -> Maybe AnException -> [(String, Double)] -> String -> [String] -> Result

-- | Number of tests performed
[numTests] :: Result -> Int

-- | Number of successful shrinking steps performed
[numShrinks] :: Result -> Int

-- | Number of unsuccessful shrinking steps performed
[numShrinkTries] :: Result -> Int

-- | Number of unsuccessful shrinking steps performed since last successful
--   shrink
[numShrinkFinal] :: Result -> Int

-- | What seed was used
[usedSeed] :: Result -> QCGen

-- | What was the test size
[usedSize] :: Result -> Int

-- | Why did the property fail
[reason] :: Result -> String

-- | The exception the property threw, if any
[theException] :: Result -> Maybe AnException

-- | Labels and frequencies found during all successful tests
[labels] :: Result -> [(String, Double)]

-- | Printed output
[output] :: Result -> String

-- | The test case which provoked the failure
[failingTestCase] :: Result -> [String]

-- | A property that should have failed did not
NoExpectedFailure :: Int -> [(String, Double)] -> String -> Result

-- | Number of tests performed
[numTests] :: Result -> Int

-- | Labels and frequencies found during all successful tests
[labels] :: Result -> [(String, Double)]

-- | Printed output
[output] :: Result -> String

-- | The tests passed but a use of <a>cover</a> had insufficient coverage
InsufficientCoverage :: Int -> [(String, Double)] -> String -> Result

-- | Number of tests performed
[numTests] :: Result -> Int

-- | Labels and frequencies found during all successful tests
[labels] :: Result -> [(String, Double)]

-- | Printed output
[output] :: Result -> String

-- | Checks that a value is total, i.e., doesn't crash when evaluated.
total :: NFData a => a -> Property

-- | Configures how many times a property will be tested.
--   
--   For example,
--   
--   <pre>
--   quickCheck (withMaxSuccess 1000 p)
--   </pre>
--   
--   will test <tt>p</tt> up to 1000 times.
withMaxSuccess :: Testable prop => Int -> prop -> Property

-- | Modifies a property so that it will be tested repeatedly. Opposite of
--   <a>once</a>.
again :: Testable prop => prop -> Property

-- | Performs an <a>IO</a> action every time a property fails. Thus, if
--   shrinking is done, this can be used to keep track of the failures
--   along the way.
whenFail' :: Testable prop => IO () -> prop -> Property

-- | Performs an <a>IO</a> action after the last failure of a property.
whenFail :: Testable prop => IO () -> prop -> Property

-- | Do I/O inside a property.
--   
--   Warning: any random values generated inside of the argument to
--   <tt>ioProperty</tt> will not currently be shrunk. For best results,
--   generate all random values before calling <tt>ioProperty</tt>.
ioProperty :: Testable prop => IO prop -> Property

-- | If a property returns <a>Discard</a>, the current test case is
--   discarded, the same as if a precondition was false.
data Discard
Discard :: Discard

-- | Extracts the value of a ternary function. <a>Fn3</a> is the pattern
--   equivalent of this function.
applyFun3 :: () => Fun (a, b, c) d -> a -> b -> c -> d

-- | Extracts the value of a binary function.
--   
--   <a>Fn2</a> is the pattern equivalent of this function.
--   
--   <pre>
--   prop_zipWith :: Fun (Int, Bool) Char -&gt; [Int] -&gt; [Bool] -&gt; Bool
--   prop_zipWith f xs ys = zipWith (applyFun2 f) xs ys == [ applyFun2 f x y | (x, y) &lt;- zip xs ys]
--   </pre>
applyFun2 :: () => Fun (a, b) c -> a -> b -> c

-- | Extracts the value of a function.
--   
--   <a>Fn</a> is the pattern equivalent of this function.
--   
--   <pre>
--   prop :: Fun String Integer -&gt; Bool
--   prop f = applyFun f "banana" == applyFun f "monkey"
--         || applyFun f "banana" == applyFun f "elephant"
--   </pre>
applyFun :: () => Fun a b -> a -> b

-- | The basic building block for <a>Function</a> instances. Provides a
--   <a>Function</a> instance by mapping to and from a type that already
--   has a <a>Function</a> instance.
functionMap :: Function b => a -> b -> b -> a -> a -> c -> a :-> c

-- | A modifier for testing functions.
--   
--   <pre>
--   prop :: Fun String Integer -&gt; Bool
--   prop (Fn f) = f "banana" == f "monkey"
--              || f "banana" == f "elephant"
--   </pre>

-- | A modifier for testing binary functions.
--   
--   <pre>
--   prop_zipWith :: Fun (Int, Bool) Char -&gt; [Int] -&gt; [Bool] -&gt; Bool
--   prop_zipWith (Fn2 f) xs ys = zipWith f xs ys == [ f x y | (x, y) &lt;- zip xs ys]
--   </pre>

-- | A modifier for testing ternary functions.

-- | The class <tt>Function a</tt> is used for random generation of
--   showable functions of type <tt>a -&gt; b</tt>.
--   
--   There is a default implementation for <a>function</a>, which you can
--   use if your type has structural equality. Otherwise, you can normally
--   use <a>functionMap</a> or <a>functionShow</a>.
class Function a
function :: Function a => a -> b -> a :-> b

-- | Generation of random shrinkable, showable functions.
--   
--   To generate random values of type <tt><a>Fun</a> a b</tt>, you must
--   have an instance <tt><a>Function</a> a</tt>.
--   
--   See also <a>applyFun</a>, and <a>Fn</a> with GHC &gt;= 7.8.
data Fun a b
Fun :: (a :-> b, b, Shrunk) -> a -> b -> Fun a b

-- | <tt>Blind x</tt>: as x, but x does not have to be in the <a>Show</a>
--   class.
newtype Blind a
Blind :: a -> Blind a
[getBlind] :: Blind a -> a

-- | <tt>Fixed x</tt>: as x, but will not be shrunk.
newtype Fixed a
Fixed :: a -> Fixed a
[getFixed] :: Fixed a -> a

-- | <tt>Ordered xs</tt>: guarantees that xs is ordered.
newtype OrderedList a
Ordered :: [a] -> OrderedList a
[getOrdered] :: OrderedList a -> [a]

-- | <tt>NonEmpty xs</tt>: guarantees that xs is non-empty.
newtype NonEmptyList a
NonEmpty :: [a] -> NonEmptyList a
[getNonEmpty] :: NonEmptyList a -> [a]

-- | <tt>InfiniteList xs _</tt>: guarantees that xs is an infinite list.
--   When a counterexample is found, only prints the prefix of xs that was
--   used by the program.
--   
--   Here is a contrived example property:
--   
--   <pre>
--   prop_take_10 :: InfiniteList Char -&gt; Bool
--   prop_take_10 (InfiniteList xs _) =
--     or [ x == 'a' | x &lt;- take 10 xs ]
--   </pre>
--   
--   In the following counterexample, the list must start with
--   <tt>"bbbbbbbbbb"</tt> but the remaining (infinite) part can contain
--   anything:
--   
--   <pre>
--   &gt;&gt;&gt; quickCheck prop_take_10
--   *** Failed! Falsifiable (after 1 test and 14 shrinks):
--   "bbbbbbbbbb" ++ ...
--   </pre>
data InfiniteList a
InfiniteList :: [a] -> InfiniteListInternalData a -> InfiniteList a
[getInfiniteList] :: InfiniteList a -> [a]
[infiniteListInternalData] :: InfiniteList a -> InfiniteListInternalData a

-- | <tt>Positive x</tt>: guarantees that <tt>x &gt; 0</tt>.
newtype Positive a
Positive :: a -> Positive a
[getPositive] :: Positive a -> a

-- | <tt>NonZero x</tt>: guarantees that <tt>x /= 0</tt>.
newtype NonZero a
NonZero :: a -> NonZero a
[getNonZero] :: NonZero a -> a

-- | <tt>NonNegative x</tt>: guarantees that <tt>x &gt;= 0</tt>.
newtype NonNegative a
NonNegative :: a -> NonNegative a
[getNonNegative] :: NonNegative a -> a

-- | <tt>Large x</tt>: by default, QuickCheck generates <a>Int</a>s drawn
--   from a small range. <tt>Large Int</tt> gives you values drawn from the
--   entire range instead.
newtype Large a
Large :: a -> Large a
[getLarge] :: Large a -> a

-- | <tt>Small x</tt>: generates values of <tt>x</tt> drawn from a small
--   range. The opposite of <a>Large</a>.
newtype Small a
Small :: a -> Small a
[getSmall] :: Small a -> a

-- | <tt>Shrink2 x</tt>: allows 2 shrinking steps at the same time when
--   shrinking x
newtype Shrink2 a
Shrink2 :: a -> Shrink2 a
[getShrink2] :: Shrink2 a -> a

-- | <tt>Smart _ x</tt>: tries a different order when shrinking.
data Smart a
Smart :: Int -> a -> Smart a

-- | <tt>Shrinking _ x</tt>: allows for maintaining a state during
--   shrinking.
data Shrinking s a
Shrinking :: s -> a -> Shrinking s a
class ShrinkState s a
shrinkInit :: ShrinkState s a => a -> s
shrinkState :: ShrinkState s a => a -> s -> [(a, s)]

-- | <tt>ASCIIString</tt>: generates an ASCII string.
newtype ASCIIString
ASCIIString :: String -> ASCIIString
[getASCIIString] :: ASCIIString -> String

-- | <tt>UnicodeString</tt>: generates a unicode String. The string will
--   not contain surrogate pairs.
newtype UnicodeString
UnicodeString :: String -> UnicodeString
[getUnicodeString] :: UnicodeString -> String

-- | <tt>PrintableString</tt>: generates a printable unicode String. The
--   string will not contain surrogate pairs.
newtype PrintableString
PrintableString :: String -> PrintableString
[getPrintableString] :: PrintableString -> String

-- | Generates an infinite list.
infiniteList :: Arbitrary a => Gen [a]

-- | Generates an ordered list.
orderedList :: (Ord a, Arbitrary a) => Gen [a]

-- | Generates a list of a given length.
vector :: Arbitrary a => Int -> Gen [a]

-- | A <a>coarbitrary</a> implementation for enums.
coarbitraryEnum :: Enum a => a -> Gen b -> Gen b

-- | <a>coarbitrary</a> helper for lazy people :-).
coarbitraryShow :: Show a => a -> Gen b -> Gen b

-- | A <a>coarbitrary</a> implementation for real numbers.
coarbitraryReal :: Real a => a -> Gen b -> Gen b

-- | A <a>coarbitrary</a> implementation for integral numbers.
coarbitraryIntegral :: Integral a => a -> Gen b -> Gen b

-- | Combine two generator perturbing functions, for example the results of
--   calls to <a>variant</a> or <a>coarbitrary</a>.
(><) :: () => Gen a -> Gen a -> Gen a -> Gen a -> Gen a -> Gen a

-- | Generic CoArbitrary implementation.
genericCoarbitrary :: (Generic a, GCoArbitrary Rep a) => a -> Gen b -> Gen b

-- | Shrink a fraction.
shrinkRealFrac :: RealFrac a => a -> [a]

-- | Shrink an integral number.
shrinkIntegral :: Integral a => a -> [a]

-- | Non-overloaded version of <a>shrinkMap</a>.
shrinkMapBy :: () => a -> b -> b -> a -> a -> [a] -> b -> [b]

-- | Map a shrink function to another domain. This is handy if your data
--   type has special invariants, but is <i>almost</i> isomorphic to some
--   other type.
--   
--   <pre>
--   shrinkOrderedList :: (Ord a, Arbitrary a) =&gt; [a] -&gt; [[a]]
--   shrinkOrderedList = shrinkMap sort id
--   
--   shrinkSet :: (Ord a, Arbitrary a) =&gt; Set a -&gt; Set [a]
--   shrinkSet = shrinkMap fromList toList
--   </pre>
shrinkMap :: Arbitrary a => a -> b -> b -> a -> b -> [b]

-- | Returns no shrinking alternatives.
shrinkNothing :: () => a -> [a]

-- | Generates a printable Unicode character.
arbitraryPrintableChar :: Gen Char

-- | Generates a random ASCII character (0-127).
arbitraryASCIIChar :: Gen Char

-- | Generates any Unicode character (but not a surrogate)
arbitraryUnicodeChar :: Gen Char

-- | Generates an integral number from a bounded domain. The number is
--   chosen from the entire range of the type, but small numbers are
--   generated more often than big numbers. Inspired by demands from Phil
--   Wadler.
arbitrarySizedBoundedIntegral :: (Bounded a, Integral a) => Gen a

-- | Generates an element of a bounded enumeration.
arbitraryBoundedEnum :: (Bounded a, Enum a) => Gen a

-- | Generates an element of a bounded type. The element is chosen from the
--   entire range of the type.
arbitraryBoundedRandom :: (Bounded a, Random a) => Gen a

-- | Generates an integral number. The number is chosen uniformly from the
--   entire range of the type. You may want to use
--   <a>arbitrarySizedBoundedIntegral</a> instead.
arbitraryBoundedIntegral :: (Bounded a, Integral a) => Gen a

-- | Generates a fractional number. The number can be positive or negative
--   and its maximum absolute value depends on the size parameter.
arbitrarySizedFractional :: Fractional a => Gen a

-- | Generates a natural number. The number's maximum value depends on the
--   size parameter.
arbitrarySizedNatural :: Integral a => Gen a

-- | Generates an integral number. The number can be positive or negative
--   and its maximum absolute value depends on the size parameter.
arbitrarySizedIntegral :: Integral a => Gen a

-- | Apply a function of arity 4 to random arguments.
applyArbitrary4 :: (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d) => a -> b -> c -> d -> r -> Gen r

-- | Apply a ternary function to random arguments.
applyArbitrary3 :: (Arbitrary a, Arbitrary b, Arbitrary c) => a -> b -> c -> r -> Gen r

-- | Apply a binary function to random arguments.
applyArbitrary2 :: (Arbitrary a, Arbitrary b) => a -> b -> r -> Gen r

-- | Shrink a list of values given a shrinking function for individual
--   values.
shrinkList :: () => a -> [a] -> [a] -> [[a]]

-- | All immediate subterms of a term.
subterms :: (Generic a, GSubterms Rep a a) => a -> [a]

-- | Recursively shrink all immediate subterms.
recursivelyShrink :: (Generic a, RecursivelyShrink Rep a) => a -> [a]

-- | Shrink a term to any of its immediate subterms, and also recursively
--   shrink all subterms.
genericShrink :: (Generic a, RecursivelyShrink Rep a, GSubterms Rep a a) => a -> [a]
shrink2 :: (Arbitrary2 f, Arbitrary a, Arbitrary b) => f a b -> [f a b]
arbitrary2 :: (Arbitrary2 f, Arbitrary a, Arbitrary b) => Gen f a b
shrink1 :: (Arbitrary1 f, Arbitrary a) => f a -> [f a]
arbitrary1 :: (Arbitrary1 f, Arbitrary a) => Gen f a

-- | Random generation and shrinking of values.
--   
--   QuickCheck provides <tt>Arbitrary</tt> instances for most types in
--   <tt>base</tt>, except those which incur extra dependencies. For a
--   wider range of <tt>Arbitrary</tt> instances see the
--   <a>quickcheck-instances</a> package.
class Arbitrary a

-- | A generator for values of the given type.
--   
--   It is worth spending time thinking about what sort of test data you
--   want - good generators are often the difference between finding bugs
--   and not finding them. You can use <a>sample</a>, <tt>label</tt> and
--   <tt>classify</tt> to check the quality of your test data.
--   
--   There is no generic <tt>arbitrary</tt> implementation included because
--   we don't know how to make a high-quality one. If you want one,
--   consider using the <a>testing-feat</a> or <a>generic-random</a>
--   packages.
--   
--   The <a>QuickCheck manual</a> goes into detail on how to write good
--   generators. Make sure to look at it, especially if your type is
--   recursive!
arbitrary :: Arbitrary a => Gen a

-- | Produces a (possibly) empty list of all the possible immediate shrinks
--   of the given value.
--   
--   The default implementation returns the empty list, so will not try to
--   shrink the value. If your data type has no special invariants, you can
--   enable shrinking by defining <tt>shrink = <a>genericShrink</a></tt>,
--   but by customising the behaviour of <tt>shrink</tt> you can often get
--   simpler counterexamples.
--   
--   Most implementations of <a>shrink</a> should try at least three
--   things:
--   
--   <ol>
--   <li>Shrink a term to any of its immediate subterms. You can use
--   <a>subterms</a> to do this.</li>
--   <li>Recursively apply <a>shrink</a> to all immediate subterms. You can
--   use <a>recursivelyShrink</a> to do this.</li>
--   <li>Type-specific shrinkings such as replacing a constructor by a
--   simpler constructor.</li>
--   </ol>
--   
--   For example, suppose we have the following implementation of binary
--   trees:
--   
--   <pre>
--   data Tree a = Nil | Branch a (Tree a) (Tree a)
--   </pre>
--   
--   We can then define <a>shrink</a> as follows:
--   
--   <pre>
--   shrink Nil = []
--   shrink (Branch x l r) =
--     -- shrink Branch to Nil
--     [Nil] ++
--     -- shrink to subterms
--     [l, r] ++
--     -- recursively shrink subterms
--     [Branch x' l' r' | (x', l', r') &lt;- shrink (x, l, r)]
--   </pre>
--   
--   There are a couple of subtleties here:
--   
--   <ul>
--   <li>QuickCheck tries the shrinking candidates in the order they appear
--   in the list, so we put more aggressive shrinking steps (such as
--   replacing the whole tree by <tt>Nil</tt>) before smaller ones (such as
--   recursively shrinking the subtrees).</li>
--   <li>It is tempting to write the last line as <tt>[Branch x' l' r' | x'
--   &lt;- shrink x, l' &lt;- shrink l, r' &lt;- shrink r]</tt> but this is
--   the <i>wrong thing</i>! It will force QuickCheck to shrink <tt>x</tt>,
--   <tt>l</tt> and <tt>r</tt> in tandem, and shrinking will stop once
--   <i>one</i> of the three is fully shrunk.</li>
--   </ul>
--   
--   There is a fair bit of boilerplate in the code above. We can avoid it
--   with the help of some generic functions. The function
--   <a>genericShrink</a> tries shrinking a term to all of its subterms
--   and, failing that, recursively shrinks the subterms. Using it, we can
--   define <a>shrink</a> as:
--   
--   <pre>
--   shrink x = shrinkToNil x ++ genericShrink x
--     where
--       shrinkToNil Nil = []
--       shrinkToNil (Branch _ l r) = [Nil]
--   </pre>
--   
--   <a>genericShrink</a> is a combination of <a>subterms</a>, which
--   shrinks a term to any of its subterms, and <a>recursivelyShrink</a>,
--   which shrinks all subterms of a term. These may be useful if you need
--   a bit more control over shrinking than <a>genericShrink</a> gives you.
--   
--   A final gotcha: we cannot define <a>shrink</a> as simply
--   <tt><a>shrink</a> x = Nil:<a>genericShrink</a> x</tt> as this shrinks
--   <tt>Nil</tt> to <tt>Nil</tt>, and shrinking will go into an infinite
--   loop.
--   
--   If all this leaves you bewildered, you might try <tt><a>shrink</a> =
--   <a>genericShrink</a></tt> to begin with, after deriving
--   <tt>Generic</tt> for your type. However, if your data type has any
--   special invariants, you will need to check that <a>genericShrink</a>
--   can't break those invariants.
shrink :: Arbitrary a => a -> [a]

-- | Lifting of the <a>Arbitrary</a> class to unary type constructors.
class Arbitrary1 (f :: * -> *)
liftArbitrary :: Arbitrary1 f => Gen a -> Gen f a
liftShrink :: Arbitrary1 f => a -> [a] -> f a -> [f a]

-- | Lifting of the <a>Arbitrary</a> class to binary type constructors.
class Arbitrary2 (f :: * -> * -> *)
liftArbitrary2 :: Arbitrary2 f => Gen a -> Gen b -> Gen f a b
liftShrink2 :: Arbitrary2 f => a -> [a] -> b -> [b] -> f a b -> [f a b]

-- | Used for random generation of functions.
--   
--   If you are using a recent GHC, there is a default definition of
--   <a>coarbitrary</a> using <a>genericCoarbitrary</a>, so if your type
--   has a <a>Generic</a> instance it's enough to say
--   
--   <pre>
--   instance CoArbitrary MyType
--   </pre>
--   
--   You should only use <a>genericCoarbitrary</a> for data types where
--   equality is structural, i.e. if you can't have two different
--   representations of the same value. An example where it's not safe is
--   sets implemented using binary search trees: the same set can be
--   represented as several different trees. Here you would have to
--   explicitly define <tt>coarbitrary s = coarbitrary (toList s)</tt>.
class CoArbitrary a

-- | Used to generate a function of type <tt>a -&gt; b</tt>. The first
--   argument is a value, the second a generator. You should use
--   <a>variant</a> to perturb the random generator; the goal is that
--   different values for the first argument will lead to different calls
--   to <a>variant</a>. An example will help:
--   
--   <pre>
--   instance CoArbitrary a =&gt; CoArbitrary [a] where
--     coarbitrary []     = <a>variant</a> 0
--     coarbitrary (x:xs) = <a>variant</a> 1 . coarbitrary (x,xs)
--   </pre>
coarbitrary :: CoArbitrary a => a -> Gen b -> Gen b

-- | Generates an infinite list.
infiniteListOf :: () => Gen a -> Gen [a]

-- | Generates a list of the given length.
vectorOf :: () => Int -> Gen a -> Gen [a]

-- | Generates a non-empty list of random length. The maximum length
--   depends on the size parameter.
listOf1 :: () => Gen a -> Gen [a]

-- | Generates a list of random length. The maximum length depends on the
--   size parameter.
listOf :: () => Gen a -> Gen [a]

-- | Takes a list of elements of increasing size, and chooses among an
--   initial segment of the list. The size of this initial segment
--   increases with the size parameter. The input list must be non-empty.
growingElements :: () => [a] -> Gen a

-- | Generates a random permutation of the given list.
shuffle :: () => [a] -> Gen [a]

-- | Generates a random subsequence of the given list.
sublistOf :: () => [a] -> Gen [a]

-- | Generates one of the given values. The input list must be non-empty.
elements :: () => [a] -> Gen a

-- | Chooses one of the given generators, with a weighted random
--   distribution. The input list must be non-empty.
frequency :: () => [(Int, Gen a)] -> Gen a

-- | Randomly uses one of the given generators. The input list must be
--   non-empty.
oneof :: () => [Gen a] -> Gen a

-- | Tries to generate a value that satisfies a predicate. If it fails to
--   do so after enough attempts, returns <tt>Nothing</tt>.
suchThatMaybe :: () => Gen a -> a -> Bool -> Gen Maybe a

-- | Generates a value for which the given function returns a <a>Just</a>,
--   and then applies the function.
suchThatMap :: () => Gen a -> a -> Maybe b -> Gen b

-- | Generates a value that satisfies a predicate.
suchThat :: () => Gen a -> a -> Bool -> Gen a

-- | Generates some example values and prints them to <tt>stdout</tt>.
sample :: Show a => Gen a -> IO ()

-- | Generates some example values.
sample' :: () => Gen a -> IO [a]

-- | Run a generator. The size passed to the generator is always 30; if you
--   want another size then you should explicitly use <a>resize</a>.
generate :: () => Gen a -> IO a

-- | Generates a random element in the given inclusive range.
choose :: Random a => (a, a) -> Gen a

-- | Adjust the size parameter, by transforming it with the given function.
scale :: () => Int -> Int -> Gen a -> Gen a

-- | Overrides the size parameter. Returns a generator which uses the given
--   size instead of the runtime-size parameter.
resize :: () => Int -> Gen a -> Gen a

-- | Generates the size parameter. Used to construct generators that depend
--   on the size parameter.
--   
--   For example, <a>listOf</a>, which uses the size parameter as an upper
--   bound on length of lists it generates, can be defined like this:
--   
--   <pre>
--   listOf :: Gen a -&gt; Gen [a]
--   listOf gen = do
--     n &lt;- getSize
--     k &lt;- choose (0,n)
--     vectorOf k gen
--   </pre>
--   
--   You can also do this using <a>sized</a>.
getSize :: Gen Int

-- | Used to construct generators that depend on the size parameter.
--   
--   For example, <a>listOf</a>, which uses the size parameter as an upper
--   bound on length of lists it generates, can be defined like this:
--   
--   <pre>
--   listOf :: Gen a -&gt; Gen [a]
--   listOf gen = sized $ \n -&gt;
--     do k &lt;- choose (0,n)
--        vectorOf k gen
--   </pre>
--   
--   You can also do this using <a>getSize</a>.
sized :: () => Int -> Gen a -> Gen a

-- | Modifies a generator using an integer seed.
variant :: Integral n => n -> Gen a -> Gen a

-- | A generator for values of type <tt>a</tt>.
--   
--   The third-party package <a>QuickCheck-GenT</a> provides a monad
--   transformer version of <tt>GenT</tt>.
data Gen a

-- | A special exception that makes QuickCheck discard the test case.
--   Normally you should use <tt>==&gt;</tt>, but if for some reason this
--   isn't possible (e.g. you are deep inside a generator), use
--   <a>discard</a> instead.
discard :: () => a
instance Test.QuickCheck.Safe.STestable Test.QuickCheck.Safe.SProperty
instance Test.QuickCheck.Safe.STestable prop => Test.QuickCheck.Safe.STestable (Test.QuickCheck.Gen.Gen prop)
instance Test.QuickCheck.Safe.STestable GHC.Types.Bool
instance (Test.QuickCheck.Arbitrary.Arbitrary a, GHC.Show.Show a, Test.QuickCheck.Safe.STestable prop) => Test.QuickCheck.Safe.STestable (a -> prop)
