-- 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.1

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
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)
