Safe Haskell  None 

Language  Haskell2010 
Synopsis
 showsType :: forall t. Typeable t => ShowS
 showsArrayType :: forall r ix e. (Typeable r, Typeable ix, Typeable e) => ShowS
 assertException :: (Testable b, NFData a, Exception exc) => (exc > b) > a > Property
 assertExceptionIO :: (Testable b, NFData a, Exception exc) => (exc > b) > IO a > Property
 assertSomeException :: NFData a => a > Property
 assertSomeExceptionIO :: NFData a => IO a > Property
 toStringException :: Either SomeException a > Either String a
 data ExpectedException = ExpectedException
 applyFun2Compat :: Fun (a, b) c > a > b > c
 guard :: Alternative f => Bool > f ()
 join :: Monad m => m (m a) > m a
 class Applicative m => Monad (m :: Type > Type) where
 class Functor (f :: Type > Type) where
 fmap :: (a > b) > f a > f b
 class Typeable (a :: k)
 mapM :: (Traversable t, Monad m) => (a > m b) > t a > m (t b)
 sequence :: (Traversable t, Monad m) => t (m a) > m (t a)
 data RealWorld :: Type
 data TyCon
 data ST s a
 labelledExamplesWithResult :: Testable prop => Args > prop > IO Result
 labelledExamplesResult :: Testable prop => prop > IO Result
 labelledExamplesWith :: Testable prop => Args > prop > IO ()
 labelledExamples :: Testable prop => prop > IO ()
 verboseCheckAll :: Q Exp
 quickCheckAll :: Q Exp
 allProperties :: Q Exp
 forAllProperties :: Q Exp
 monomorphic :: Name > ExpQ
 polyVerboseCheck :: Name > ExpQ
 polyQuickCheck :: Name > ExpQ
 runSTGen :: (forall s. Gen (ST s a)) > Gen a
 monadicST :: Testable a => (forall s. PropertyM (ST s) a) > Property
 monadicIO :: Testable a => PropertyM IO a > Property
 monadic' :: (Testable a, Monad m) => PropertyM m a > Gen (m Property)
 monadic :: (Testable a, Monad m) => (m Property > Property) > PropertyM m a > Property
 monitor :: Monad m => (Property > Property) > PropertyM m ()
 forAllM :: (Monad m, Show a) => Gen a > (a > PropertyM m b) > PropertyM m b
 wp :: Monad m => m a > (a > PropertyM m b) > PropertyM m b
 pick :: (Monad m, Show a) => Gen a > PropertyM m a
 run :: Monad m => m a > PropertyM m a
 pre :: Monad m => Bool > PropertyM m ()
 assert :: Monad m => Bool > PropertyM m ()
 stop :: (Testable prop, Monad m) => prop > PropertyM m a
 newtype PropertyM (m :: Type > Type) a = MkPropertyM {
 unPropertyM :: (a > Gen (m Property)) > Gen (m Property)
 verboseCheckWithResult :: Testable prop => Args > prop > IO Result
 verboseCheckResult :: Testable prop => prop > IO Result
 verboseCheckWith :: Testable prop => Args > prop > IO ()
 verboseCheck :: Testable prop => prop > IO ()
 quickCheckWithResult :: Testable prop => Args > prop > IO Result
 quickCheckResult :: Testable prop => prop > IO Result
 quickCheckWith :: Testable prop => Args > prop > IO ()
 quickCheck :: Testable prop => prop > IO ()
 stdArgs :: Args
 isSuccess :: Result > Bool
 data Args = Args {
 replay :: Maybe (QCGen, Int)
 maxSuccess :: Int
 maxDiscardRatio :: Int
 maxSize :: Int
 chatty :: Bool
 maxShrinks :: Int
 data Result
 = Success { }
  GaveUp { }
  Failure {
 numTests :: Int
 numDiscarded :: Int
 numShrinks :: Int
 numShrinkTries :: Int
 numShrinkFinal :: Int
 usedSeed :: QCGen
 usedSize :: Int
 reason :: String
 theException :: Maybe AnException
 output :: String
 failingTestCase :: [String]
 failingLabels :: [String]
 failingClasses :: Set String
  NoExpectedFailure { }
 total :: NFData a => a > Property
 (=/=) :: (Eq a, Show a) => a > a > Property
 (===) :: (Eq a, Show a) => a > a > Property
 disjoin :: Testable prop => [prop] > Property
 (..) :: (Testable prop1, Testable prop2) => prop1 > prop2 > Property
 conjoin :: Testable prop => [prop] > Property
 (.&&.) :: (Testable prop1, Testable prop2) => prop1 > prop2 > Property
 forAllShrinkBlind :: Testable prop => Gen a > (a > [a]) > (a > prop) > Property
 forAllShrinkShow :: Testable prop => Gen a > (a > [a]) > (a > String) > (a > prop) > Property
 forAllShrink :: (Show a, Testable prop) => Gen a > (a > [a]) > (a > prop) > Property
 forAllBlind :: Testable prop => Gen a > (a > prop) > Property
 forAllShow :: Testable prop => Gen a > (a > String) > (a > prop) > Property
 forAll :: (Show a, Testable prop) => Gen a > (a > prop) > Property
 within :: Testable prop => Int > prop > Property
 (==>) :: Testable prop => Bool > prop > Property
 coverTable :: Testable prop => String > [(String, Double)] > prop > Property
 tabulate :: Testable prop => String > [String] > prop > Property
 cover :: Testable prop => Double > Bool > String > prop > Property
 classify :: Testable prop => Bool > String > prop > Property
 collect :: (Show a, Testable prop) => a > prop > Property
 label :: Testable prop => String > prop > Property
 stdConfidence :: Confidence
 checkCoverageWith :: Testable prop => Confidence > prop > Property
 checkCoverage :: Testable prop => prop > Property
 withMaxSuccess :: Testable prop => Int > prop > Property
 again :: Testable prop => prop > Property
 once :: Testable prop => prop > Property
 expectFailure :: Testable prop => prop > Property
 verboseShrinking :: Testable prop => prop > Property
 verbose :: Testable prop => prop > Property
 whenFail' :: Testable prop => IO () > prop > Property
 whenFail :: Testable prop => IO () > prop > Property
 printTestCase :: Testable prop => String > prop > Property
 counterexample :: Testable prop => String > prop > Property
 noShrinking :: Testable prop => prop > Property
 shrinking :: Testable prop => (a > [a]) > a > (a > prop) > Property
 mapSize :: Testable prop => (Int > Int) > prop > Property
 idempotentIOProperty :: Testable prop => IO prop > Property
 ioProperty :: Testable prop => IO prop > Property
 data Property
 class Testable prop where
 data Discard = Discard
 data Confidence = Confidence {}
 applyFun3 :: Fun (a, b, c) d > a > b > c > d
 applyFun2 :: Fun (a, b) c > a > b > c
 applyFun :: Fun a b > a > b
 apply :: Fun a b > a > b
 functionMap :: Function b => (a > b) > (b > a) > (a > c) > a :> c
 functionVoid :: (forall b. void > b) > void :> c
 functionShow :: (Show a, Read a) => (a > c) > a :> c
 functionIntegral :: Integral a => (a > b) > a :> b
 functionRealFrac :: RealFrac a => (a > b) > a :> b
 functionBoundedEnum :: (Eq a, Bounded a, Enum a) => (a > b) > a :> b
 pattern Fn :: forall a b. (a > b) > Fun a b
 pattern Fn2 :: forall a b c. (a > b > c) > Fun (a, b) c
 pattern Fn3 :: forall a b c d. (a > b > c > d) > Fun (a, b, c) d
 data a :> c
 class Function a where
 data Fun a b = Fun (a :> b, b, Shrunk) (a > b)
 newtype Blind a = Blind {
 getBlind :: a
 newtype Fixed a = Fixed {
 getFixed :: a
 newtype OrderedList a = Ordered {
 getOrdered :: [a]
 newtype NonEmptyList a = NonEmpty {
 getNonEmpty :: [a]
 data InfiniteList a = InfiniteList {
 getInfiniteList :: [a]
 infiniteListInternalData :: InfiniteListInternalData a
 newtype SortedList a = Sorted {
 getSorted :: [a]
 newtype Positive a = Positive {
 getPositive :: a
 newtype Negative a = Negative {
 getNegative :: a
 newtype NonZero a = NonZero {
 getNonZero :: a
 newtype NonNegative a = NonNegative {
 getNonNegative :: a
 newtype NonPositive a = NonPositive {
 getNonPositive :: a
 newtype Large a = Large {
 getLarge :: a
 newtype Small a = Small {
 getSmall :: a
 newtype Shrink2 a = Shrink2 {
 getShrink2 :: a
 data Smart a = Smart Int a
 data Shrinking s a = Shrinking s a
 class ShrinkState s a where
 shrinkInit :: a > s
 shrinkState :: a > s > [(a, s)]
 newtype ASCIIString = ASCIIString {}
 newtype UnicodeString = UnicodeString {}
 newtype PrintableString = PrintableString {}
 infiniteList :: Arbitrary a => Gen [a]
 orderedList :: (Ord a, Arbitrary a) => Gen [a]
 vector :: Arbitrary a => Int > Gen [a]
 coarbitraryEnum :: Enum a => a > Gen b > Gen b
 coarbitraryShow :: Show a => a > Gen b > Gen b
 coarbitraryReal :: Real a => a > Gen b > Gen b
 coarbitraryIntegral :: Integral a => a > Gen b > Gen b
 (><) :: (Gen a > Gen a) > (Gen a > Gen a) > Gen a > Gen a
 genericCoarbitrary :: (Generic a, GCoArbitrary (Rep a)) => a > Gen b > Gen b
 shrinkDecimal :: RealFrac a => a > [a]
 shrinkRealFrac :: RealFrac a => a > [a]
 shrinkIntegral :: Integral a => a > [a]
 shrinkMapBy :: (a > b) > (b > a) > (a > [a]) > b > [b]
 shrinkMap :: Arbitrary a => (a > b) > (b > a) > b > [b]
 shrinkNothing :: a > [a]
 arbitraryPrintableChar :: Gen Char
 arbitraryASCIIChar :: Gen Char
 arbitraryUnicodeChar :: Gen Char
 arbitrarySizedBoundedIntegral :: (Bounded a, Integral a) => Gen a
 arbitraryBoundedEnum :: (Bounded a, Enum a) => Gen a
 arbitraryBoundedRandom :: (Bounded a, Random a) => Gen a
 arbitraryBoundedIntegral :: (Bounded a, Integral a) => Gen a
 arbitrarySizedFractional :: Fractional a => Gen a
 arbitrarySizedNatural :: Integral a => Gen a
 arbitrarySizedIntegral :: Integral a => Gen a
 applyArbitrary4 :: (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d) => (a > b > c > d > r) > Gen r
 applyArbitrary3 :: (Arbitrary a, Arbitrary b, Arbitrary c) => (a > b > c > r) > Gen r
 applyArbitrary2 :: (Arbitrary a, Arbitrary b) => (a > b > r) > Gen r
 shrinkList :: (a > [a]) > [a] > [[a]]
 subterms :: (Generic a, GSubterms (Rep a) a) => a > [a]
 recursivelyShrink :: (Generic a, RecursivelyShrink (Rep a)) => a > [a]
 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)
 class Arbitrary a where
 class Arbitrary1 (f :: Type > Type) where
 liftArbitrary :: Gen a > Gen (f a)
 liftShrink :: (a > [a]) > f a > [f a]
 class Arbitrary2 (f :: Type > Type > Type) where
 liftArbitrary2 :: Gen a > Gen b > Gen (f a b)
 liftShrink2 :: (a > [a]) > (b > [b]) > f a b > [f a b]
 class CoArbitrary a where
 coarbitrary :: a > Gen b > Gen b
 infiniteListOf :: Gen a > Gen [a]
 vectorOf :: Int > Gen a > Gen [a]
 listOf1 :: Gen a > Gen [a]
 listOf :: Gen a > Gen [a]
 growingElements :: [a] > Gen a
 shuffle :: [a] > Gen [a]
 sublistOf :: [a] > Gen [a]
 elements :: [a] > Gen a
 frequency :: [(Int, Gen a)] > Gen a
 oneof :: [Gen a] > Gen a
 suchThatMaybe :: Gen a > (a > Bool) > Gen (Maybe a)
 suchThatMap :: Gen a > (a > Maybe b) > Gen b
 suchThat :: Gen a > (a > Bool) > Gen a
 sample :: Show a => Gen a > IO ()
 sample' :: Gen a > IO [a]
 generate :: Gen a > IO a
 choose :: Random a => (a, a) > Gen a
 scale :: (Int > Int) > Gen a > Gen a
 resize :: Int > Gen a > Gen a
 getSize :: Gen Int
 sized :: (Int > Gen a) > Gen a
 variant :: Integral n => n > Gen a > Gen a
 data Gen a
 discard :: a
 mfilter :: MonadPlus m => (a > Bool) > m a > m a
 (<$!>) :: Monad m => (a > b) > m a > m b
 unless :: Applicative f => Bool > f () > f ()
 replicateM_ :: Applicative m => Int > m a > m ()
 replicateM :: Applicative m => Int > m a > m [a]
 foldM_ :: (Foldable t, Monad m) => (b > a > m b) > b > t a > m ()
 foldM :: (Foldable t, Monad m) => (b > a > m b) > b > t a > m b
 zipWithM_ :: Applicative m => (a > b > m c) > [a] > [b] > m ()
 zipWithM :: Applicative m => (a > b > m c) > [a] > [b] > m [c]
 mapAndUnzipM :: Applicative m => (a > m (b, c)) > [a] > m ([b], [c])
 forever :: Applicative f => f a > f b
 (<=<) :: Monad m => (b > m c) > (a > m b) > a > m c
 (>=>) :: Monad m => (a > m b) > (b > m c) > a > m c
 filterM :: Applicative m => (a > m Bool) > [a] > m [a]
 forM :: (Traversable t, Monad m) => t a > (a > m b) > m (t b)
 fixST :: (a > ST s a) > ST s a
 stToIO :: ST RealWorld a > IO a
 typeOf7 :: Typeable t => t a b c d e f g > TypeRep
 typeOf6 :: Typeable t => t a b c d e f > TypeRep
 typeOf5 :: Typeable t => t a b c d e > TypeRep
 typeOf4 :: Typeable t => t a b c d > TypeRep
 typeOf3 :: Typeable t => t a b c > TypeRep
 typeOf2 :: Typeable t => t a b > TypeRep
 typeOf1 :: Typeable t => t a > TypeRep
 rnfTypeRep :: TypeRep > ()
 typeRepFingerprint :: TypeRep > Fingerprint
 typeRepTyCon :: TypeRep > TyCon
 typeRepArgs :: TypeRep > [TypeRep]
 splitTyConApp :: TypeRep > (TyCon, [TypeRep])
 mkFunTy :: TypeRep > TypeRep > TypeRep
 funResultTy :: TypeRep > TypeRep > Maybe TypeRep
 gcast2 :: (Typeable t, Typeable t') => c (t a b) > Maybe (c (t' a b))
 gcast1 :: (Typeable t, Typeable t') => c (t a) > Maybe (c (t' a))
 gcast :: (Typeable a, Typeable b) => c a > Maybe (c b)
 eqT :: (Typeable a, Typeable b) => Maybe (a :~: b)
 cast :: (Typeable a, Typeable b) => a > Maybe b
 showsTypeRep :: TypeRep > ShowS
 typeRep :: Typeable a => proxy a > TypeRep
 typeOf :: Typeable a => a > TypeRep
 type TypeRep = SomeTypeRep
 rnfTyCon :: TyCon > ()
 tyConFingerprint :: TyCon > Fingerprint
 tyConName :: TyCon > String
 tyConModule :: TyCon > String
 tyConPackage :: TyCon > String
 msum :: (Foldable t, MonadPlus m) => t (m a) > m a
 sequence_ :: (Foldable t, Monad m) => t (m a) > m ()
 forM_ :: (Foldable t, Monad m) => t a > (a > m b) > m ()
 mapM_ :: (Foldable t, Monad m) => (a > m b) > t a > m ()
 data Proxy (t :: k) :: forall k. k > Type = Proxy
 data (a :: k) :~: (b :: k) :: forall k. k > k > Type where
 data (a :: k1) :~~: (b :: k2) :: forall k1 k2. k1 > k2 > Type where
 runST :: (forall s. ST s a) > a
 void :: Functor f => f a > f ()
 fromMaybe :: a > Maybe a > a
 isNothing :: Maybe a > Bool
 isJust :: Maybe a > Bool
 ap :: Monad m => m (a > b) > m a > m b
 liftM5 :: Monad m => (a1 > a2 > a3 > a4 > a5 > r) > m a1 > m a2 > m a3 > m a4 > m a5 > m r
 liftM4 :: Monad m => (a1 > a2 > a3 > a4 > r) > m a1 > m a2 > m a3 > m a4 > m r
 liftM3 :: Monad m => (a1 > a2 > a3 > r) > m a1 > m a2 > m a3 > m r
 liftM2 :: Monad m => (a1 > a2 > r) > m a1 > m a2 > m r
 liftM :: Monad m => (a1 > r) > m a1 > m r
 when :: Applicative f => Bool > f () > f ()
 (=<<) :: Monad m => (a > m b) > m a > m b
 class (Alternative m, Monad m) => MonadPlus (m :: Type > Type) where
 type HasCallStack = ?callStack :: CallStack
 deepseq :: NFData a => a > b > b
 class NFData a
 type Selector a = a > Bool
 type Expectation = Assertion
 expectationFailure :: HasCallStack > String > Expectation
 shouldBe :: (HasCallStack, Show a, Eq a) => a > a > Expectation
 shouldSatisfy :: (HasCallStack, Show a) => a > (a > Bool) > Expectation
 shouldStartWith :: (HasCallStack, Show a, Eq a) => [a] > [a] > Expectation
 shouldEndWith :: (HasCallStack, Show a, Eq a) => [a] > [a] > Expectation
 shouldContain :: (HasCallStack, Show a, Eq a) => [a] > [a] > Expectation
 shouldMatchList :: (HasCallStack, Show a, Eq a) => [a] > [a] > Expectation
 shouldReturn :: (HasCallStack, Show a, Eq a) => IO a > a > Expectation
 shouldNotBe :: (HasCallStack, Show a, Eq a) => a > a > Expectation
 shouldNotSatisfy :: (HasCallStack, Show a) => a > (a > Bool) > Expectation
 shouldNotContain :: (HasCallStack, Show a, Eq a) => [a] > [a] > Expectation
 shouldNotReturn :: (HasCallStack, Show a, Eq a) => IO a > a > Expectation
 shouldThrow :: (HasCallStack, Exception e) => IO a > Selector e > Expectation
 anyException :: Selector SomeException
 anyErrorCall :: Selector ErrorCall
 errorCall :: String > Selector ErrorCall
 anyIOException :: Selector IOException
 anyArithException :: Selector ArithException
 prop :: (HasCallStack, Testable prop) => String > prop > Spec
 example :: Expectation > Expectation
 type ActionWith a = a > IO ()
 class Example e where
 type SpecWith a = SpecM a ()
 type Spec = SpecWith ()
 runIO :: IO r > SpecM a r
 before :: IO a > SpecWith a > Spec
 before_ :: IO () > SpecWith a > SpecWith a
 beforeWith :: (b > IO a) > SpecWith a > SpecWith b
 beforeAll :: IO a > SpecWith a > Spec
 beforeAll_ :: IO () > SpecWith a > SpecWith a
 after :: ActionWith a > SpecWith a > SpecWith a
 after_ :: IO () > SpecWith a > SpecWith a
 around :: (ActionWith a > IO ()) > SpecWith a > Spec
 afterAll :: ActionWith a > SpecWith a > SpecWith a
 afterAll_ :: IO () > SpecWith a > SpecWith a
 around_ :: (IO () > IO ()) > SpecWith a > SpecWith a
 aroundWith :: (ActionWith a > ActionWith b) > SpecWith a > SpecWith b
 describe :: HasCallStack => String > SpecWith a > SpecWith a
 context :: HasCallStack => String > SpecWith a > SpecWith a
 xdescribe :: HasCallStack => String > SpecWith a > SpecWith a
 xcontext :: HasCallStack => String > SpecWith a > SpecWith a
 it :: (HasCallStack, Example a) => String > a > SpecWith (Arg a)
 specify :: (HasCallStack, Example a) => String > a > SpecWith (Arg a)
 xit :: (HasCallStack, Example a) => String > a > SpecWith (Arg a)
 xspecify :: (HasCallStack, Example a) => String > a > SpecWith (Arg a)
 focus :: SpecWith a > SpecWith a
 fit :: (HasCallStack, Example a) => String > a > SpecWith (Arg a)
 fspecify :: (HasCallStack, Example a) => String > a > SpecWith (Arg a)
 fdescribe :: HasCallStack => String > SpecWith a > SpecWith a
 fcontext :: HasCallStack => String > SpecWith a > SpecWith a
 parallel :: SpecWith a > SpecWith a
 pending :: HasCallStack > Expectation
 pendingWith :: HasCallStack > String > Expectation
 modifyMaxSuccess :: (Int > Int) > SpecWith a > SpecWith a
 modifyMaxDiscardRatio :: (Int > Int) > SpecWith a > SpecWith a
 modifyMaxSize :: (Int > Int) > SpecWith a > SpecWith a
 modifyMaxShrinks :: (Int > Int) > SpecWith a > SpecWith a
 modifyArgs :: (Args > Args) > SpecWith a > SpecWith a
 hspec :: Spec > IO ()
Documentation
showsArrayType :: forall r ix e. (Typeable r, Typeable ix, Typeable e) => ShowS Source #
Use Typeable to show the array type
assertSomeException :: NFData a => a > Property Source #
toStringException :: Either SomeException a > Either String a Source #
data ExpectedException Source #
Instances
Eq ExpectedException Source #  
Defined in Test.Massiv.Utils (==) :: ExpectedException > ExpectedException > Bool # (/=) :: ExpectedException > ExpectedException > Bool #  
Show ExpectedException Source #  
Defined in Test.Massiv.Utils showsPrec :: Int > ExpectedException > ShowS # show :: ExpectedException > String # showList :: [ExpectedException] > ShowS #  
Exception ExpectedException Source #  
Defined in Test.Massiv.Utils 
applyFun2Compat :: Fun (a, b) c > a > b > c Source #
guard :: Alternative f => Bool > f () #
Conditional failure of Alternative
computations. Defined by
guard True =pure
() guard False =empty
Examples
Common uses of guard
include conditionally signaling an error in
an error monad and conditionally rejecting the current choice in an
Alternative
based parser.
As an example of signaling an error in the error monad Maybe
,
consider a safe division function safeDiv x y
that returns
Nothing
when the denominator y
is zero and
otherwise. For example:Just
(x `div`
y)
>>> safeDiv 4 0 Nothing >>> safeDiv 4 2 Just 2
A definition of safeDiv
using guards, but not guard
:
safeDiv :: Int > Int > Maybe Int safeDiv x y  y /= 0 = Just (x `div` y)  otherwise = Nothing
A definition of safeDiv
using guard
and Monad
do
notation:
safeDiv :: Int > Int > Maybe Int safeDiv x y = do guard (y /= 0) return (x `div` y)
join :: Monad m => m (m a) > m a #
The join
function is the conventional monad join operator. It
is used to remove one level of monadic structure, projecting its
bound argument into the outer level.
Examples
A common use of join
is to run an IO
computation returned from
an STM
transaction, since STM
transactions
can't perform IO
directly. Recall that
atomically
:: STM a > IO a
is used to run STM
transactions atomically. So, by
specializing the types of atomically
and join
to
atomically
:: STM (IO b) > IO (IO b)join
:: IO (IO b) > IO b
we can compose them as
join
.atomically
:: STM (IO b) > IO b
class Applicative m => Monad (m :: Type > Type) where #
The Monad
class defines the basic operations over a monad,
a concept from a branch of mathematics known as category theory.
From the perspective of a Haskell programmer, however, it is best to
think of a monad as an abstract datatype of actions.
Haskell's do
expressions provide a convenient syntax for writing
monadic expressions.
Instances of Monad
should satisfy the following laws:
Furthermore, the Monad
and Applicative
operations should relate as follows:
The above laws imply:
and that pure
and (<*>
) satisfy the applicative functor laws.
The instances of Monad
for lists, Maybe
and IO
defined in the Prelude satisfy these laws.
(>>=) :: m a > (a > m b) > m b infixl 1 #
Sequentially compose two actions, passing any value produced by the first as an argument to the second.
(>>) :: m a > m b > m b infixl 1 #
Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.
Inject a value into the monadic type.
Fail with a message. This operation is not part of the
mathematical definition of a monad, but is invoked on patternmatch
failure in a do
expression.
As part of the MonadFail proposal (MFP), this function is moved
to its own class MonadFail
(see Control.Monad.Fail for more
details). The definition here will be removed in a future
release.
Instances
Monad []  Since: base2.1 
Monad Maybe  Since: base2.1 
Monad IO  Since: base2.1 
Monad Par1  Since: base4.9.0.0 
Monad Q  
Monad Rose  
Monad Gen  
Monad Complex  Since: base4.9.0.0 
Monad Min  Since: base4.9.0.0 
Monad Max  Since: base4.9.0.0 
Monad First  Since: base4.9.0.0 
Monad Last  Since: base4.9.0.0 
Monad Option  Since: base4.9.0.0 
Monad Identity  Since: base4.8.0.0 
Monad STM  Since: base4.3.0.0 
Monad First  Since: base4.8.0.0 
Monad Last  Since: base4.8.0.0 
Monad Dual  Since: base4.8.0.0 
Monad Sum  Since: base4.8.0.0 
Monad Product  Since: base4.8.0.0 
Monad Down  Since: base4.11.0.0 
Monad ReadP  Since: base2.1 
Monad NonEmpty  Since: base4.9.0.0 
Monad Tree  
Monad Seq  
Monad Vector  
Monad Box  
Monad Id  
Monad SmallArray  
Defined in Data.Primitive.SmallArray (>>=) :: SmallArray a > (a > SmallArray b) > SmallArray b # (>>) :: SmallArray a > SmallArray b > SmallArray b # return :: a > SmallArray a # fail :: String > SmallArray a #  
Monad Array  
Monad P  Since: base2.1 
Monad (Either e)  Since: base4.4.0.0 
Monad (U1 :: Type > Type)  Since: base4.9.0.0 
Monoid a => Monad ((,) a)  Since: base4.9.0.0 
Monad (ST s)  Since: base2.1 
Monad m => Monad (PropertyM m)  
Monad m => Monad (WrappedMonad m)  Since: base4.7.0.0 
Defined in Control.Applicative (>>=) :: WrappedMonad m a > (a > WrappedMonad m b) > WrappedMonad m b # (>>) :: WrappedMonad m a > WrappedMonad m b > WrappedMonad m b # return :: a > WrappedMonad m a # fail :: String > WrappedMonad m a #  
ArrowApply a => Monad (ArrowMonad a)  Since: base2.1 
Defined in Control.Arrow (>>=) :: ArrowMonad a a0 > (a0 > ArrowMonad a b) > ArrowMonad a b # (>>) :: ArrowMonad a a0 > ArrowMonad a b > ArrowMonad a b # return :: a0 > ArrowMonad a a0 # fail :: String > ArrowMonad a a0 #  
Monad (Proxy :: Type > Type)  Since: base4.7.0.0 
Monad m => Monad (MaybeT m)  
Monad (SpecM a)  
Monad m => Monad (ListT m)  
Monad f => Monad (Rec1 f)  Since: base4.9.0.0 
Monad f => Monad (Ap f)  Since: base4.12.0.0 
Monad f => Monad (Alt f)  Since: base4.8.0.0 
(Applicative f, Monad f) => Monad (WhenMissing f x)  Equivalent to Since: containers0.5.9 
Defined in Data.IntMap.Internal (>>=) :: WhenMissing f x a > (a > WhenMissing f x b) > WhenMissing f x b # (>>) :: WhenMissing f x a > WhenMissing f x b > WhenMissing f x b # return :: a > WhenMissing f x a # fail :: String > WhenMissing f x a #  
Monad m => Monad (ExceptT e m)  
Monad (Array DS Ix1)  
Monad m => Monad (IdentityT m)  
(Monad m, Error e) => Monad (ErrorT e m)  
Monad m => Monad (StateT s m)  
Monad m => Monad (StateT s m)  
(Monoid w, Monad m) => Monad (WriterT w m)  
(Monoid w, Monad m) => Monad (WriterT w m)  
(Monoid w, Functor m, Monad m) => Monad (AccumT w m)  
Monad m => Monad (SelectT r m)  
Monad ((>) r :: Type > Type)  Since: base2.1 
(Monad f, Monad g) => Monad (f :*: g)  Since: base4.9.0.0 
(Monad f, Monad g) => Monad (Product f g)  Since: base4.9.0.0 
(Monad f, Applicative f) => Monad (WhenMatched f x y)  Equivalent to Since: containers0.5.9 
Defined in Data.IntMap.Internal (>>=) :: WhenMatched f x y a > (a > WhenMatched f x y b) > WhenMatched f x y b # (>>) :: WhenMatched f x y a > WhenMatched f x y b > WhenMatched f x y b # return :: a > WhenMatched f x y a # fail :: String > WhenMatched f x y a #  
(Applicative f, Monad f) => Monad (WhenMissing f k x)  Equivalent to Since: containers0.5.9 
Defined in Data.Map.Internal (>>=) :: WhenMissing f k x a > (a > WhenMissing f k x b) > WhenMissing f k x b # (>>) :: WhenMissing f k x a > WhenMissing f k x b > WhenMissing f k x b # return :: a > WhenMissing f k x a # fail :: String > WhenMissing f k x a #  
Monad (ContT r m)  
Monad m => Monad (ReaderT r m)  
Monad f => Monad (M1 i c f)  Since: base4.9.0.0 
(Monad f, Applicative f) => Monad (WhenMatched f k x y)  Equivalent to Since: containers0.5.9 
Defined in Data.Map.Internal (>>=) :: WhenMatched f k x y a > (a > WhenMatched f k x y b) > WhenMatched f k x y b # (>>) :: WhenMatched f k x y a > WhenMatched f k x y b > WhenMatched f k x y b # return :: a > WhenMatched f k x y a # fail :: String > WhenMatched f k x y a #  
(Monoid w, Monad m) => Monad (RWST r w s m)  
(Monoid w, Monad m) => Monad (RWST r w s m)  
class Functor (f :: Type > Type) where #
The Functor
class is used for types that can be mapped over.
Instances of Functor
should satisfy the following laws:
fmap id == id fmap (f . g) == fmap f . fmap g
The instances of Functor
for lists, Maybe
and IO
satisfy these laws.
Instances
The class Typeable
allows a concrete representation of a type to
be calculated.
typeRep#
mapM :: (Traversable t, Monad m) => (a > m b) > t a > m (t b) #
Map each element of a structure to a monadic action, evaluate
these actions from left to right, and collect the results. For
a version that ignores the results see mapM_
.
sequence :: (Traversable t, Monad m) => t (m a) > m (t a) #
Evaluate each monadic action in the structure from left to
right, and collect the results. For a version that ignores the
results see sequence_
.
RealWorld
is deeply magical. It is primitive, but it is not
unlifted (hence ptrArg
). We never manipulate values of type
RealWorld
; it's only used in the type system, to parameterise State#
.
The strict statetransformer monad.
A computation of type
transforms an internal state indexed
by ST
s as
, and returns a value of type a
.
The s
parameter is either
 an uninstantiated type variable (inside invocations of
runST
), or RealWorld
(inside invocations ofstToIO
).
It serves to keep the internal states of different invocations
of runST
separate from each other and from invocations of
stToIO
.
The >>=
and >>
operations are strict in the state (though not in
values stored in the state). For example,
runST
(writeSTRef __ v >>= f) = __
Instances
Monad (ST s)  Since: base2.1 
Functor (ST s)  Since: base2.1 
MonadFail (ST s)  Since: base4.11.0.0 
Applicative (ST s)  Since: base4.4.0.0 
MonadThrow (ST s)  
Defined in Control.Monad.Catch  
PrimMonad (ST s)  
PrimBase (ST s)  
Show (ST s a)  Since: base2.1 
Semigroup a => Semigroup (ST s a)  Since: base4.11.0.0 
Monoid a => Monoid (ST s a)  Since: base4.11.0.0 
type PrimState (ST s)  
Defined in Control.Monad.Primitive 
labelledExamplesWithResult :: Testable prop => Args > prop > IO Result #
A variant of labelledExamples
that takes test arguments and returns a result.
labelledExamplesResult :: Testable prop => prop > IO Result #
A variant of labelledExamples
that returns a result.
labelledExamplesWith :: Testable prop => Args > prop > IO () #
A variant of labelledExamples
that takes test arguments.
labelledExamples :: Testable prop => prop > IO () #
Given a property, which must use label
, collect
, classify
or cover
to associate labels with test cases, find an example test case for each possible label.
The example test cases are minimised using shrinking.
For example, suppose we test
and record the number
of times that delete
x xsx
occurs in xs
:
prop_delete :: Int > [Int] > Property prop_delete x xs = classify (count x xs == 0) "count x xs == 0" $ classify (count x xs == 1) "count x xs == 1" $ classify (count x xs >= 2) "count x xs >= 2" $ counterexample (show (delete x xs)) $ count x (delete x xs) == max 0 (count x xs1) where count x xs = length (filter (== x) xs)
labelledExamples
generates three example test cases, one for each label:
>>>
labelledExamples prop_delete
*** Found example of count x xs == 0 0 [] [] *** Found example of count x xs == 1 0 [0] [] *** Found example of count x xs >= 2 5 [5,5] [5] +++ OK, passed 100 tests: 78% count x xs == 0 21% count x xs == 1 1% count x xs >= 2
verboseCheckAll :: Q Exp #
Test all properties in the current module.
This is just a convenience function that combines quickCheckAll
and verbose
.
verboseCheckAll
has the same issue with scoping as quickCheckAll
:
see the note there about return []
.
quickCheckAll :: Q Exp #
Test all properties in the current module.
The name of the property must begin with prop_
.
Polymorphic properties will be defaulted to Integer
.
Returns True
if all tests succeeded, False
otherwise.
To use quickCheckAll
, add a definition to your module along
the lines of
return [] runTests = $quickCheckAll
and then execute runTests
.
Note: the bizarre return []
in the example above is needed on
GHC 7.8 and later; without it, quickCheckAll
will not be able to find
any of the properties. For the curious, the return []
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 return []
before it starts on the rest
of the module, which means that the later call to quickCheckAll
can see everything that was defined before the return []
. Yikes!
allProperties :: Q Exp #
List all properties in the current module.
$
has type allProperties
[(
.String
, Property
)]
allProperties
has the same issue with scoping as quickCheckAll
:
see the note there about return []
.
forAllProperties :: Q Exp #
Test all properties in the current module, using a custom
quickCheck
function. The same caveats as with quickCheckAll
apply.
$
has type forAllProperties
(
.
An example invocation is Property
> IO
Result
) > IO
Bool
$
,
which does the same thing as forAllProperties
quickCheckResult
$
.quickCheckAll
forAllProperties
has the same issue with scoping as quickCheckAll
:
see the note there about return []
.
monomorphic :: Name > ExpQ #
Monomorphise an arbitrary property by defaulting all type variables to Integer
.
For example, if f
has type
then Ord
a => [a] > [a]$(
has type monomorphic
'f)[
.Integer
] > [Integer
]
If you want to use monomorphic
in the same file where you defined the
property, the same scoping problems pop up as in quickCheckAll
:
see the note there about return []
.
polyVerboseCheck :: Name > ExpQ #
Test a polymorphic property, defaulting all type variables to Integer
.
This is just a convenience function that combines verboseCheck
and monomorphic
.
If you want to use polyVerboseCheck
in the same file where you defined the
property, the same scoping problems pop up as in quickCheckAll
:
see the note there about return []
.
polyQuickCheck :: Name > ExpQ #
Test a polymorphic property, defaulting all type variables to Integer
.
Invoke as $(
, where polyQuickCheck
'prop)prop
is a property.
Note that just evaluating
in GHCi will seem to
work, but will silently default all type variables to quickCheck
prop()
!
$(
means the same as
polyQuickCheck
'prop)
.
If you want to supply custom arguments to quickCheck
$(monomorphic
'prop)polyQuickCheck
,
you will have to combine quickCheckWith
and monomorphic
yourself.
If you want to use polyQuickCheck
in the same file where you defined the
property, the same scoping problems pop up as in quickCheckAll
:
see the note there about return []
.
monadicST :: Testable a => (forall s. PropertyM (ST s) a) > Property #
Runs the property monad for ST
computations.
 Your mutable sorting algorithm here sortST :: Ord a => [a] >ST
s (MVector s a) sortST =thaw
.fromList
.sort
prop_sortST xs = monadicST $ do sorted < run (freeze
=<< sortST xs) assert (toList
sorted == sort xs)
>>>
quickCheck prop_sortST
+++ OK, passed 100 tests.
monadicIO :: Testable a => PropertyM IO a > Property #
Runs the property monad for IO
computations.
prop_cat msg = monadicIO $ do (exitCode, stdout, _) < run (readProcessWithExitCode
"cat" [] msg) pre (ExitSuccess
== exitCode) assert (stdout == msg)
>>>
quickCheck prop_cat
+++ OK, passed 100 tests.
monitor :: Monad m => (Property > Property) > PropertyM m () #
Allows making observations about the test data:
monitor (collect
e)
collects the distribution of value of e
.
monitor (counterexample
"Failure!")
Adds "Failure!"
to the counterexamples.
run :: Monad m => m a > PropertyM m a #
The lifting operation of the property monad. Allows embedding
monadic/IO
actions in properties:
log :: Int > IO () prop_foo n = monadicIO $ do run (log n)  ...
pre :: Monad m => Bool > PropertyM m () #
Tests preconditions. Unlike assert
this does not cause the
property to fail, rather it discards them just like using the
implication combinator ==>
.
This allows representing the Hoare triple
{p} x ← e{q}
as
pre p x < run e assert q
assert :: Monad m => Bool > PropertyM m () #
Allows embedding nonmonadic properties into monadic ones.
newtype PropertyM (m :: Type > Type) a #
The property monad is really a monad transformer that can contain
monadic computations in the monad m
it is parameterized by:
m
 them
computations that may be performed withinPropertyM
Elements of PropertyM m a
may mix property operations and m
computations.
MkPropertyM  

Instances
MonadTrans PropertyM  
Defined in Test.QuickCheck.Monadic  
Monad m => Monad (PropertyM m)  
Functor (PropertyM m)  
Monad m => MonadFail (PropertyM m)  
Defined in Test.QuickCheck.Monadic  
Applicative (PropertyM m)  
Defined in Test.QuickCheck.Monadic  
MonadIO m => MonadIO (PropertyM m)  
Defined in Test.QuickCheck.Monadic 
verboseCheckWithResult :: Testable prop => Args > prop > IO Result #
Tests a property, using test arguments, produces a test result, and prints the results and all test cases generated to stdout
.
This is just a convenience function that combines quickCheckWithResult
and verbose
.
verboseCheckResult :: Testable prop => prop > IO Result #
Tests a property, produces a test result, and prints the results and all test cases generated to stdout
.
This is just a convenience function that combines quickCheckResult
and verbose
.
verboseCheckWith :: Testable prop => Args > prop > IO () #
Tests a property, using test arguments, and prints the results and all test cases generated to stdout
.
This is just a convenience function that combines quickCheckWith
and verbose
.
verboseCheck :: Testable prop => prop > IO () #
Tests a property and prints the results and all test cases generated to stdout
.
This is just a convenience function that means the same as
.quickCheck
. verbose
quickCheckWithResult :: Testable prop => Args > prop > IO Result #
Tests a property, using test arguments, produces a test result, and prints the results to stdout
.
quickCheckResult :: Testable prop => prop > IO Result #
Tests a property, produces a test result, and prints the results to stdout
.
quickCheckWith :: Testable prop => Args > prop > IO () #
Tests a property, using test arguments, and prints the results to stdout
.
quickCheck :: Testable prop => prop > IO () #
Tests a property and prints the results to stdout
.
By default up to 100 tests are performed, which may not be enough
to find all bugs. To run more tests, use withMaxSuccess
.
If you want to get the counterexample as a Haskell value, rather than just printing it, try the quickcheckwithcounterexamples package.
Args specifies arguments to the QuickCheck driver
Args  

Result represents the test result
Success  A successful test run 
 
GaveUp  Given up 
 
Failure  A failed test run 
 
NoExpectedFailure  A property that should have failed did not 

total :: NFData a => a > Property #
Checks that a value is total, i.e., doesn't crash when evaluated.
(=/=) :: (Eq a, Show a) => a > a > Property infix 4 #
Like /=
, but prints a counterexample when it fails.
(===) :: (Eq a, Show a) => a > a > Property infix 4 #
Like ==
, but prints a counterexample when it fails.
(..) :: (Testable prop1, Testable prop2) => prop1 > prop2 > Property infixr 1 #
Disjunction: p1
..
p2
passes unless p1
and p2
simultaneously fail.
(.&&.) :: (Testable prop1, Testable prop2) => prop1 > prop2 > Property infixr 1 #
Conjunction: p1
.&&.
p2
passes if both p1
and p2
pass.
forAllShrinkBlind :: Testable prop => Gen a > (a > [a]) > (a > prop) > Property #
Like forAllShrink
, but without printing the generated value.
forAllShrinkShow :: Testable prop => Gen a > (a > [a]) > (a > String) > (a > prop) > Property #
Like forAllShrink
, but with an explicitly given show function.
forAllShrink :: (Show a, Testable prop) => Gen a > (a > [a]) > (a > prop) > Property #
Like forAll
, but tries to shrink the argument for failing test cases.
forAllBlind :: Testable prop => Gen a > (a > prop) > Property #
Like forAll
, but without printing the generated value.
forAllShow :: Testable prop => Gen a > (a > String) > (a > prop) > Property #
Like forAll
, but with an explicitly given show function.
forAll :: (Show a, Testable prop) => Gen a > (a > prop) > Property #
Explicit universal quantification: uses an explicitly given test case generator.
within :: Testable prop => Int > prop > Property #
Considers a property failed if it does not complete within the given number of microseconds.
Note: if the property times out, variables quantified inside the
within
will not be printed. Therefore, you should use within
only in the body of your property.
Good: prop_foo a b c = within 1000000 ...
Bad: prop_foo = within 1000000 $ \a b c > ...
Bad: prop_foo a b c = ...; main = quickCheck (within 1000000 prop_foo)
(==>) :: Testable prop => Bool > prop > Property infixr 0 #
Implication for properties: The resulting property holds if
the first argument is False
(in which case the test case is discarded),
or if the given property holds. Note that using implication carelessly can
severely skew test case distribution: consider using cover
to make sure
that your test data is still good quality.
coverTable :: Testable prop => String > [(String, Double)] > prop > Property #
Checks that the values in a given table
appear a certain proportion of
the time. A call to coverTable
table
[(x1, p1), ..., (xn, pn)]
asserts
that of the values in table
, x1
should appear at least p1
percent of
the time, x2
at least p2
percent of the time, and so on.
Note: If the coverage check fails, QuickCheck prints out a warning, but
the property does not fail. To make the property fail, use checkCoverage
.
Continuing the example from the tabular
combinator...
data Command = LogIn  LogOut  SendMessage String deriving (Data, Show) prop_chatroom :: [Command] > Property prop_chatroom cmds = wellFormed cmds LoggedOut ==> 'tabulate' "Commands" (map (show . 'Data.Data.toConstr') cmds) $ ...
...we can add a coverage requirement as follows, which checks that LogIn
,
LogOut
and SendMessage
each occur at least 25% of the time:
prop_chatroom :: [Command] > Property prop_chatroom cmds = wellFormed cmds LoggedOut ==> coverTable "Commands" [("LogIn", 25), ("LogOut", 25), ("SendMessage", 25)] $ 'tabulate' "Commands" (map (show . 'Data.Data.toConstr') cmds) $ ... property goes here ...
>>>
quickCheck prop_chatroom
+++ OK, passed 100 tests; 2909 discarded: 56% 0 17% 1 10% 2 6% 3 5% 4 3% 5 3% 7 Commands (111 in total): 51.4% LogIn 30.6% SendMessage 18.0% LogOut Table 'Commands' had only 18.0% LogOut, but expected 25.0%
tabulate :: Testable prop => String > [String] > prop > Property #
Collects information about test case distribution into a table.
The arguments to tabulate
are the table's name and a list of values
associated with the current test case. After testing, QuickCheck prints the
frequency of all collected values. The frequencies are expressed as a
percentage of the total number of values collected.
You should prefer tabulate
to label
when each test case is associated
with a varying number of values. Here is a (not terribly useful) example,
where the test data is a list of integers and we record all values that
occur in the list:
prop_sorted_sort :: [Int] > Property prop_sorted_sort xs = sorted xs ==> tabulate "List elements" (map show xs) $ sort xs === xs
>>>
quickCheck prop_sorted_sort
+++ OK, passed 100 tests; 1684 discarded. List elements (109 in total): 3.7% 0 3.7% 17 3.7% 2 3.7% 6 2.8% 6 2.8% 7
Here is a more useful example. We are testing a chatroom, where the user can log in, log out, or send a message:
data Command = LogIn  LogOut  SendMessage String deriving (Data, Show) instance Arbitrary Command where ...
There are some restrictions on command sequences; for example, the user must
log in before doing anything else. The function valid :: [Command] > Bool
checks that a command sequence is allowed. Our property then has the form:
prop_chatroom :: [Command] > Property prop_chatroom cmds = valid cmds ==> ...
The use of ==>
may skew test case distribution. We use collect
to see the
length of the command sequences, and tabulate
to get the frequencies of the
individual commands:
prop_chatroom :: [Command] > Property prop_chatroom cmds = wellFormed cmds LoggedOut ==> 'collect' (length cmds) $ 'tabulate' "Commands" (map (show . 'Data.Data.toConstr') cmds) $ ...
>>>
quickCheckWith stdArgs{maxDiscardRatio = 1000} prop_chatroom
+++ OK, passed 100 tests; 2775 discarded: 60% 0 20% 1 15% 2 3% 3 1% 4 1% 5 Commands (68 in total): 62% LogIn 22% SendMessage 16% LogOut
:: Testable prop  
=> Double  The required percentage (0100) of test cases. 
> Bool 

> String  Label for the test case class. 
> prop  
> Property 
Checks that at least the given proportion of successful test cases belong to the given class. Discarded tests (i.e. ones with a false precondition) do not affect coverage.
Note: If the coverage check fails, QuickCheck prints out a warning, but
the property does not fail. To make the property fail, use checkCoverage
.
For example:
prop_sorted_sort :: [Int] > Property prop_sorted_sort xs = sorted xs ==> cover 50 (length xs > 1) "nontrivial" $ sort xs === xs
>>>
quickCheck prop_sorted_sort
+++ OK, passed 100 tests; 135 discarded (26% nontrivial). Only 26% nontrivial, but expected 50%
Reports how many test cases satisfy a given condition.
For example:
prop_sorted_sort :: [Int] > Property prop_sorted_sort xs = sorted xs ==> classify (length xs > 1) "nontrivial" $ sort xs === xs
>>>
quickCheck prop_sorted_sort
+++ OK, passed 100 tests (22% nontrivial).
collect :: (Show a, Testable prop) => a > prop > Property #
Attaches a label to a test case. This is used for reporting test case distribution.
collect x = label (show x)
For example:
prop_reverse_reverse :: [Int] > Property prop_reverse_reverse xs = collect (length xs) $ reverse (reverse xs) === xs
>>>
quickCheck prop_reverse_reverse
+++ OK, passed 100 tests: 7% 7 6% 3 5% 4 4% 6 ...
Each use of collect
in your property results in a separate
table of test case distribution in the output. If this is
not what you want, use tabulate
.
label :: Testable prop => String > prop > Property #
Attaches a label to a test case. This is used for reporting test case distribution.
For example:
prop_reverse_reverse :: [Int] > Property prop_reverse_reverse xs = label ("length of input is " ++ show (length xs)) $ reverse (reverse xs) === xs
>>>
quickCheck prop_reverse_reverse
+++ OK, passed 100 tests: 7% length of input is 7 6% length of input is 3 5% length of input is 4 4% length of input is 6 ...
Each use of label
in your property results in a separate
table of test case distribution in the output. If this is
not what you want, use tabulate
.
The standard parameters used by checkCoverage
: certainty = 10^9
,
tolerance = 0.9
. See Confidence
for the meaning of the parameters.
checkCoverageWith :: Testable prop => Confidence > prop > Property #
Check coverage requirements using a custom confidence level.
See stdConfidence
.
An example of making the statistical test less stringent in order to improve performance:
quickCheck (checkCoverageWith stdConfidence{certainty = 10^6} prop_foo)
checkCoverage :: Testable prop => prop > Property #
Check that all coverage requirements defined by cover
and coverTable
are met, using a statistically sound test, and fail if they are not met.
Ordinarily, a failed coverage check does not cause the property to fail.
This is because the coverage requirement is not tested in a statistically
sound way. If you use cover
to express that a certain value must appear 20%
of the time, QuickCheck will warn you if the value only appears in 19 out of
100 test cases  but since the coverage varies randomly, you may have just
been unlucky, and there may not be any real problem with your test
generation.
When you use checkCoverage
, QuickCheck uses a statistical test to account
for the role of luck in coverage failures. It will run as many tests as
needed until it is sure about whether the coverage requirements are met. If a
coverage requirement is not met, the property fails.
Example:
quickCheck (checkCoverage prop_foo)
withMaxSuccess :: Testable prop => Int > prop > Property #
Configures how many times a property will be tested.
For example,
quickCheck (withMaxSuccess 1000 p)
will test p
up to 1000 times.
again :: Testable prop => prop > Property #
Modifies a property so that it will be tested repeatedly.
Opposite of once
.
once :: Testable prop => prop > Property #
Modifies a property so that it only will be tested once.
Opposite of again
.
expectFailure :: Testable prop => prop > Property #
Indicates that a property is supposed to fail. QuickCheck will report an error if it does not fail.
verboseShrinking :: Testable prop => prop > Property #
Prints out the generated testcase every time the property fails, including during shrinking.
Only variables quantified over inside the verboseShrinking
are printed.
verbose :: Testable prop => prop > Property #
Prints out the generated testcase every time the property is tested.
Only variables quantified over inside the verbose
are printed.
whenFail' :: Testable prop => IO () > prop > Property #
Performs an IO
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 IO
action after the last failure of a property.
printTestCase :: Testable prop => String > prop > Property #
Adds the given string to the counterexample if the property fails.
counterexample :: Testable prop => String > prop > Property #
Adds the given string to the counterexample if the property fails.
noShrinking :: Testable prop => prop > Property #
Disables shrinking for a property altogether.
Only quantification inside the call to noShrinking
is affected.
:: Testable prop  
=> (a > [a]) 

> a  The original argument 
> (a > prop)  
> Property 
Shrinks the argument to a property if it fails. Shrinking is done automatically for most types. This function is only needed when you want to override the default behavior.
mapSize :: Testable prop => (Int > Int) > prop > Property #
Adjust the test case size for a property, by transforming it with the given function.
idempotentIOProperty :: Testable prop => IO prop > Property #
Do I/O inside a property.
Warning: during shrinking, the I/O may not always be reexecuted.
Instead, the I/O may be executed once and then its result retained.
If this is not acceptable, use ioProperty
instead.
ioProperty :: Testable prop => IO prop > Property #
Do I/O inside a property.
Warning: any random values generated inside of the argument to ioProperty
will not currently be shrunk. For best results, generate all random values
before calling ioProperty
, or use idempotentIOProperty
if that is safe.
Note: if your property does no quantification, it will only be tested once.
To test it repeatedly, use again
.
The type of properties.
Instances
Testable Property  
Example Property  
Defined in Test.Hspec.Core.Example evaluateExample :: Property > Params > (ActionWith (Arg Property) > IO ()) > ProgressCallback > IO Result #  
Example (a > Property)  
Defined in Test.Hspec.Core.Example evaluateExample :: (a > Property) > Params > (ActionWith (Arg (a > Property)) > IO ()) > ProgressCallback > IO Result #  
type Arg Property  
Defined in Test.Hspec.Core.Example  
type Arg (a > Property)  
Defined in Test.Hspec.Core.Example 
The class of properties, i.e., types which QuickCheck knows how to test.
Typically a property will be a function returning Bool
or Property
.
If a property does no quantification, i.e. has no
parameters and doesn't use forAll
, it will only be tested once.
This may not be what you want if your property is an IO Bool
.
You can change this behaviour using the again
combinator.
property :: prop > Property #
Convert the thing to a property.
propertyForAllShrinkShow :: Gen a > (a > [a]) > (a > [String]) > (a > prop) > Property #
Optional; used internally in order to improve shrinking.
Tests a property but also quantifies over an extra value
(with a custom shrink and show function).
The Testable
instance for functions defines
propertyForAllShrinkShow
in a way that improves shrinking.
Instances
Testable Bool  
Testable ()  
Defined in Test.QuickCheck.Property  
Testable Prop  
Defined in Test.QuickCheck.Property  
Testable Result  
Defined in Test.QuickCheck.Property  
Testable Property  
Testable Discard  
Testable prop => Testable (Maybe prop)  
Testable prop => Testable (Gen prop)  
(Arbitrary a, Show a, Testable prop) => Testable (a > prop)  
Defined in Test.QuickCheck.Property 
data Confidence #
The statistical parameters used by checkCoverage
.
Confidence  

Instances
Show Confidence  
Defined in Test.QuickCheck.State showsPrec :: Int > Confidence > ShowS # show :: Confidence > String # showList :: [Confidence] > ShowS # 
applyFun3 :: Fun (a, b, c) d > a > b > c > d #
Extracts the value of a ternary function. Fn3
is the
pattern equivalent of this function.
applyFun2 :: Fun (a, b) c > a > b > c #
Extracts the value of a binary function.
Fn2
is the pattern equivalent of this function.
prop_zipWith :: Fun (Int, Bool) Char > [Int] > [Bool] > Bool prop_zipWith f xs ys = zipWith (applyFun2 f) xs ys == [ applyFun2 f x y  (x, y) < zip xs ys]
applyFun :: Fun a b > a > b #
Extracts the value of a function.
Fn
is the pattern equivalent of this function.
prop :: Fun String Integer > Bool prop f = applyFun f "banana" == applyFun f "monkey"  applyFun f "banana" == applyFun f "elephant"
functionMap :: Function b => (a > b) > (b > a) > (a > c) > a :> c #
functionVoid :: (forall b. void > b) > void :> c #
functionShow :: (Show a, Read a) => (a > c) > a :> c #
functionIntegral :: Integral a => (a > b) > a :> b #
functionRealFrac :: RealFrac a => (a > b) > a :> b #
pattern Fn :: forall a b. (a > b) > Fun a b #
A modifier for testing functions.
prop :: Fun String Integer > Bool prop (Fn f) = f "banana" == f "monkey"  f "banana" == f "elephant"
pattern Fn2 :: forall a b c. (a > b > c) > Fun (a, b) c #
A modifier for testing binary functions.
prop_zipWith :: Fun (Int, Bool) Char > [Int] > [Bool] > Bool prop_zipWith (Fn2 f) xs ys = zipWith f xs ys == [ f x y  (x, y) < zip xs ys]
pattern Fn3 :: forall a b c d. (a > b > c > d) > Fun (a, b, c) d #
A modifier for testing ternary functions.
The type of possibly partial concrete functions
The class Function a
is used for random generation of showable
functions of type a > b
.
There is a default implementation for function
, which you can use
if your type has structural equality. Otherwise, you can normally
use functionMap
or functionShow
.
Nothing
Instances
Generation of random shrinkable, showable functions.
To generate random values of type
,
you must have an instance Fun
a b
.Function
a
Blind x
: as x, but x does not have to be in the Show
class.
Instances
Functor Blind  
Enum a => Enum (Blind a)  
Eq a => Eq (Blind a)  
Integral a => Integral (Blind a)  
Defined in Test.QuickCheck.Modifiers  
Num a => Num (Blind a)  
Ord a => Ord (Blind a)  
Real a => Real (Blind a)  
Defined in Test.QuickCheck.Modifiers toRational :: Blind a > Rational #  
Show (Blind a)  
Arbitrary a => Arbitrary (Blind a)  
Fixed x
: as x, but will not be shrunk.
Instances
Functor Fixed  
Enum a => Enum (Fixed a)  
Eq a => Eq (Fixed a)  
Integral a => Integral (Fixed a)  
Defined in Test.QuickCheck.Modifiers  
Num a => Num (Fixed a)  
Ord a => Ord (Fixed a)  
Read a => Read (Fixed a)  
Real a => Real (Fixed a)  
Defined in Test.QuickCheck.Modifiers toRational :: Fixed a > Rational #  
Show a => Show (Fixed a)  
Arbitrary a => Arbitrary (Fixed a)  
newtype OrderedList a #
Ordered xs
: guarantees that xs is ordered.
Ordered  

Instances
newtype NonEmptyList a #
NonEmpty xs
: guarantees that xs is nonempty.
NonEmpty  

Instances
data InfiniteList a #
InfiniteList xs _
: 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:
prop_take_10 :: InfiniteList Char > Bool prop_take_10 (InfiniteList xs _) = or [ x == 'a'  x < take 10 xs ]
In the following counterexample, the list must start with "bbbbbbbbbb"
but
the remaining (infinite) part can contain anything:
>>>
quickCheck prop_take_10
*** Failed! Falsified (after 1 test and 14 shrinks): "bbbbbbbbbb" ++ ...
InfiniteList  

Instances
Show a => Show (InfiniteList a)  
Defined in Test.QuickCheck.Modifiers showsPrec :: Int > InfiniteList a > ShowS # show :: InfiniteList a > String # showList :: [InfiniteList a] > ShowS #  
Arbitrary a => Arbitrary (InfiniteList a)  
Defined in Test.QuickCheck.Modifiers arbitrary :: Gen (InfiniteList a) # shrink :: InfiniteList a > [InfiniteList a] # 
newtype SortedList a #
Sorted xs
: guarantees that xs is sorted.
Instances
Positive x
: guarantees that x > 0
.
Positive  

Instances
Functor Positive  
Enum a => Enum (Positive a)  
Defined in Test.QuickCheck.Modifiers succ :: Positive a > Positive a # pred :: Positive a > Positive a # fromEnum :: Positive a > Int # enumFrom :: Positive a > [Positive a] # enumFromThen :: Positive a > Positive a > [Positive a] # enumFromTo :: Positive a > Positive a > [Positive a] # enumFromThenTo :: Positive a > Positive a > Positive a > [Positive a] #  
Eq a => Eq (Positive a)  
Ord a => Ord (Positive a)  
Read a => Read (Positive a)  
Show a => Show (Positive a)  
(Num a, Ord a, Arbitrary a) => Arbitrary (Positive a)  
Negative x
: guarantees that x < 0
.
Negative  

Instances
Functor Negative  
Enum a => Enum (Negative a)  
Defined in Test.QuickCheck.Modifiers succ :: Negative a > Negative a # pred :: Negative a > Negative a # fromEnum :: Negative a > Int # enumFrom :: Negative a > [Negative a] # enumFromThen :: Negative a > Negative a > [Negative a] # enumFromTo :: Negative a > Negative a > [Negative a] # enumFromThenTo :: Negative a > Negative a > Negative a > [Negative a] #  
Eq a => Eq (Negative a)  
Ord a => Ord (Negative a)  
Read a => Read (Negative a)  
Show a => Show (Negative a)  
(Num a, Ord a, Arbitrary a) => Arbitrary (Negative a)  
NonZero x
: guarantees that x /= 0
.
NonZero  

Instances
Functor NonZero  
Enum a => Enum (NonZero a)  
Defined in Test.QuickCheck.Modifiers succ :: NonZero a > NonZero a # pred :: NonZero a > NonZero a # fromEnum :: NonZero a > Int # enumFrom :: NonZero a > [NonZero a] # enumFromThen :: NonZero a > NonZero a > [NonZero a] # enumFromTo :: NonZero a > NonZero a > [NonZero a] # enumFromThenTo :: NonZero a > NonZero a > NonZero a > [NonZero a] #  
Eq a => Eq (NonZero a)  
Ord a => Ord (NonZero a)  
Defined in Test.QuickCheck.Modifiers  
Read a => Read (NonZero a)  
Show a => Show (NonZero a)  
(Num a, Eq a, Arbitrary a) => Arbitrary (NonZero a)  
newtype NonNegative a #
NonNegative x
: guarantees that x >= 0
.
Instances
newtype NonPositive a #
NonPositive x
: guarantees that x <= 0
.
Instances
Large x
: by default, QuickCheck generates Int
s drawn from a small
range. Large Int
gives you values drawn from the entire range instead.
Instances
Functor Large  
Enum a => Enum (Large a)  
Eq a => Eq (Large a)  
Integral a => Integral (Large a)  
Defined in Test.QuickCheck.Modifiers  
Num a => Num (Large a)  
Ord a => Ord (Large a)  
Read a => Read (Large a)  
Real a => Real (Large a)  
Defined in Test.QuickCheck.Modifiers toRational :: Large a > Rational #  
Show a => Show (Large a)  
Ix a => Ix (Large a)  
Defined in Test.QuickCheck.Modifiers  
(Integral a, Bounded a) => Arbitrary (Large a)  
Small x
: generates values of x
drawn from a small range.
The opposite of Large
.
Instances
Functor Small  
Enum a => Enum (Small a)  
Eq a => Eq (Small a)  
Integral a => Integral (Small a)  
Defined in Test.QuickCheck.Modifiers  
Num a => Num (Small a)  
Ord a => Ord (Small a)  
Read a => Read (Small a)  
Real a => Real (Small a)  
Defined in Test.QuickCheck.Modifiers toRational :: Small a > Rational #  
Show a => Show (Small a)  
Ix a => Ix (Small a)  
Defined in Test.QuickCheck.Modifiers  
Integral a => Arbitrary (Small a)  
Shrink2 x
: allows 2 shrinking steps at the same time when shrinking x
Shrink2  

Instances
Functor Shrink2  
Enum a => Enum (Shrink2 a)  
Defined in Test.QuickCheck.Modifiers succ :: Shrink2 a > Shrink2 a # pred :: Shrink2 a > Shrink2 a # fromEnum :: Shrink2 a > Int # enumFrom :: Shrink2 a > [Shrink2 a] # enumFromThen :: Shrink2 a > Shrink2 a > [Shrink2 a] # enumFromTo :: Shrink2 a > Shrink2 a > [Shrink2 a] # enumFromThenTo :: Shrink2 a > Shrink2 a > Shrink2 a > [Shrink2 a] #  
Eq a => Eq (Shrink2 a)  
Integral a => Integral (Shrink2 a)  
Defined in Test.QuickCheck.Modifiers  
Num a => Num (Shrink2 a)  
Defined in Test.QuickCheck.Modifiers  
Ord a => Ord (Shrink2 a)  
Defined in Test.QuickCheck.Modifiers  
Read a => Read (Shrink2 a)  
Real a => Real (Shrink2 a)  
Defined in Test.QuickCheck.Modifiers toRational :: Shrink2 a > Rational #  
Show a => Show (Shrink2 a)  
Arbitrary a => Arbitrary (Shrink2 a)  
Smart _ x
: tries a different order when shrinking.
Shrinking _ x
: allows for maintaining a state during shrinking.
Shrinking s a 
class ShrinkState s a where #
shrinkInit :: a > s #
shrinkState :: a > s > [(a, s)] #
newtype ASCIIString #
ASCIIString
: generates an ASCII string.
Instances
newtype UnicodeString #
UnicodeString
: generates a unicode String.
The string will not contain surrogate pairs.
Instances
newtype PrintableString #
PrintableString
: generates a printable unicode String.
The string will not contain surrogate pairs.
Instances
Eq PrintableString  
Defined in Test.QuickCheck.Modifiers (==) :: PrintableString > PrintableString > Bool # (/=) :: PrintableString > PrintableString > Bool #  
Ord PrintableString  
Defined in Test.QuickCheck.Modifiers compare :: PrintableString > PrintableString > Ordering # (<) :: PrintableString > PrintableString > Bool # (<=) :: PrintableString > PrintableString > Bool # (>) :: PrintableString > PrintableString > Bool # (>=) :: PrintableString > PrintableString > Bool # max :: PrintableString > PrintableString > PrintableString # min :: PrintableString > PrintableString > PrintableString #  
Read PrintableString  
Defined in Test.QuickCheck.Modifiers  
Show PrintableString  
Defined in Test.QuickCheck.Modifiers showsPrec :: Int > PrintableString > ShowS # show :: PrintableString > String # showList :: [PrintableString] > ShowS #  
Arbitrary PrintableString  
Defined in Test.QuickCheck.Modifiers arbitrary :: Gen PrintableString # shrink :: PrintableString > [PrintableString] # 
infiniteList :: Arbitrary a => Gen [a] #
Generates an infinite list.
orderedList :: (Ord a, Arbitrary a) => Gen [a] #
Generates an ordered list.
coarbitraryEnum :: Enum a => a > Gen b > Gen b #
A coarbitrary
implementation for enums.
coarbitraryShow :: Show a => a > Gen b > Gen b #
coarbitrary
helper for lazy people :).
coarbitraryReal :: Real a => a > Gen b > Gen b #
A coarbitrary
implementation for real numbers.
coarbitraryIntegral :: Integral a => a > Gen b > Gen b #
A coarbitrary
implementation for integral numbers.
(><) :: (Gen a > Gen a) > (Gen a > Gen a) > Gen a > Gen a #
Combine two generator perturbing functions, for example the
results of calls to variant
or coarbitrary
.
genericCoarbitrary :: (Generic a, GCoArbitrary (Rep a)) => a > Gen b > Gen b #
Generic CoArbitrary implementation.
shrinkDecimal :: RealFrac a => a > [a] #
Shrink a real number, preferring numbers with shorter
decimal representations. See also shrinkRealFrac
.
shrinkRealFrac :: RealFrac a => a > [a] #
Shrink a fraction, preferring numbers with smaller
numerators or denominators. See also shrinkDecimal
.
shrinkIntegral :: Integral a => a > [a] #
Shrink an integral number.
shrinkMapBy :: (a > b) > (b > a) > (a > [a]) > b > [b] #
Nonoverloaded version of shrinkMap
.
shrinkMap :: Arbitrary a => (a > b) > (b > a) > b > [b] #
Map a shrink function to another domain. This is handy if your data type has special invariants, but is almost isomorphic to some other type.
shrinkOrderedList :: (Ord a, Arbitrary a) => [a] > [[a]] shrinkOrderedList = shrinkMap sort id shrinkSet :: (Ord a, Arbitrary a) => Set a > Set [a] shrinkSet = shrinkMap fromList toList
shrinkNothing :: a > [a] #
Returns no shrinking alternatives.
arbitraryPrintableChar :: Gen Char #
Generates a printable Unicode character.
arbitraryASCIIChar :: Gen Char #
Generates a random ASCII character (0127).
arbitraryUnicodeChar :: Gen Char #
Generates any Unicode character (but not a surrogate)
arbitrarySizedBoundedIntegral :: (Bounded a, Integral a) => Gen a #
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.
arbitraryBoundedEnum :: (Bounded a, Enum a) => Gen a #
Generates an element of a bounded enumeration.
arbitraryBoundedRandom :: (Bounded a, Random a) => Gen a #
Generates an element of a bounded type. The element is chosen from the entire range of the type.
arbitraryBoundedIntegral :: (Bounded a, Integral a) => Gen a #
Generates an integral number. The number is chosen uniformly from
the entire range of the type. You may want to use
arbitrarySizedBoundedIntegral
instead.
arbitrarySizedFractional :: Fractional a => Gen a #
Generates a fractional number. The number can be positive or negative and its maximum absolute value depends on the size parameter.
arbitrarySizedNatural :: Integral a => Gen a #
Generates a natural number. The number's maximum value depends on the size parameter.
arbitrarySizedIntegral :: 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.
applyArbitrary4 :: (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d) => (a > b > c > d > r) > Gen r #
Apply a function of arity 4 to random arguments.
applyArbitrary3 :: (Arbitrary a, Arbitrary b, Arbitrary c) => (a > b > c > r) > Gen r #
Apply a ternary function to random arguments.
applyArbitrary2 :: (Arbitrary a, Arbitrary b) => (a > b > r) > Gen r #
Apply a binary function to random arguments.
shrinkList :: (a > [a]) > [a] > [[a]] #
Shrink a list of values given a shrinking function for individual values.
recursivelyShrink :: (Generic a, RecursivelyShrink (Rep a)) => a > [a] #
Recursively shrink all immediate subterms.
genericShrink :: (Generic a, RecursivelyShrink (Rep a), GSubterms (Rep a) a) => a > [a] #
Shrink a term to any of its immediate subterms, and also recursively shrink all subterms.
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 Arbitrary
instances for most types in base
,
except those which incur extra dependencies.
For a wider range of Arbitrary
instances see the
quickcheckinstances
package.
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 sample
,
label
and classify
to check the quality of your test data.
There is no generic arbitrary
implementation included because we don't
know how to make a highquality one. If you want one, consider using the
testingfeat or
genericrandom packages.
The QuickCheck manual goes into detail on how to write good generators. Make sure to look at it, especially if your type is recursive!
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 shrink =
, but by customising
the behaviour of genericShrink
shrink
you can often get simpler counterexamples.
Most implementations of shrink
should try at least three things:
 Shrink a term to any of its immediate subterms.
You can use
subterms
to do this.  Recursively apply
shrink
to all immediate subterms. You can userecursivelyShrink
to do this.  Typespecific shrinkings such as replacing a constructor by a simpler constructor.
For example, suppose we have the following implementation of binary trees:
data Tree a = Nil  Branch a (Tree a) (Tree a)
We can then define shrink
as follows:
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') < shrink (x, l, r)]
There are a couple of subtleties here:
 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
Nil
) before smaller ones (such as recursively shrinking the subtrees).  It is tempting to write the last line as
[Branch x' l' r'  x' < shrink x, l' < shrink l, r' < shrink r]
but this is the wrong thing! It will force QuickCheck to shrinkx
,l
andr
in tandem, and shrinking will stop once one of the three is fully shrunk.
There is a fair bit of boilerplate in the code above.
We can avoid it with the help of some generic functions.
The function genericShrink
tries shrinking a term to all of its
subterms and, failing that, recursively shrinks the subterms.
Using it, we can define shrink
as:
shrink x = shrinkToNil x ++ genericShrink x where shrinkToNil Nil = [] shrinkToNil (Branch _ l r) = [Nil]
genericShrink
is a combination of subterms
, which shrinks
a term to any of its subterms, and recursivelyShrink
, which shrinks
all subterms of a term. These may be useful if you need a bit more
control over shrinking than genericShrink
gives you.
A final gotcha: we cannot define shrink
as simply
as this shrinks shrink
x = Nil:genericShrink
xNil
to Nil
, and shrinking will go into an
infinite loop.
If all this leaves you bewildered, you might try
to begin with,
after deriving shrink
= genericShrink
Generic
for your type. However, if your data type has any
special invariants, you will need to check that genericShrink
can't break those invariants.
Instances
Arbitrary Bool  
Arbitrary Char  
Arbitrary Double  
Arbitrary Float  
Arbitrary Int  
Arbitrary Int8  
Arbitrary Int16  
Arbitrary Int32  
Arbitrary Int64  
Arbitrary Integer  
Arbitrary Ordering  
Arbitrary Word  
Arbitrary Word8  
Arbitrary Word16  
Arbitrary Word32  
Arbitrary Word64  
Arbitrary ()  
Arbitrary Version  Generates 
Arbitrary QCGen  
Arbitrary ASCIIString  
Defined in Test.QuickCheck.Modifiers arbitrary :: Gen ASCIIString # shrink :: ASCIIString > [ASCIIString] #  
Arbitrary 