Test.QuickCheck.Modifiers

QuickCheck-2.15.0.1: Automatic testing of Haskell programs

Safe Haskell | Trustworthy
Language | Haskell2010

Test.QuickCheck.Modifiers

Contents

- Type-level modifiers for changing generator behavior

Description

Modifiers for test data.

These types do things such as restricting the kind of test data that can be generated. They can be pattern-matched on in properties as a stylistic alternative to using explicit quantification.

Note: the contents of this module are re-exported by Test.QuickCheck. You do not need to import it directly.

Examples:

    -- Functions cannot be shown (but see Test.QuickCheck.Function)
    prop_TakeDropWhile (Blind p) (xs :: [A]) =
      takeWhile p xs ++ dropWhile p xs == xs

    prop_TakeDrop (NonNegative n) (xs :: [A]) =
      take n xs ++ drop n xs == xs

    -- cycle does not work for empty lists
    prop_Cycle (NonNegative n) (NonEmpty (xs :: [A])) =
      take n (cycle xs) == take n (xs ++ cycle xs)

    -- Instead of forAll orderedList
    prop_Sort (Ordered (xs :: [OrdA])) =
      sort xs == xs

Synopsis

- 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
  }
- data Smart a = Smart Int a
- newtype Shrink2 a = Shrink2 {
  - getShrink2 :: a
  }
- data Shrinking s a = Shrinking s a
- class ShrinkState s a where
  - shrinkInit :: a -> s
  - shrinkState :: a -> s -> [(a, s)]
- newtype ASCIIString = ASCIIString {
  - getASCIIString :: String
  }
- newtype UnicodeString = UnicodeString {
  - getUnicodeString :: String
  }
- newtype PrintableString = PrintableString {
  - getPrintableString :: String
  }

## Type-level modifiers for changing generator behavior

newtype Blind a #

`Blind x`: as x, but x does not have to be in the `Show` class.

Constructors

Blind |
Fields getBlind :: a

#### Instances

Instances details

Functor Blind # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Blind a -> Blind b # (<$) :: a -> Blind b -> Blind a #
Arbitrary a => Arbitrary (Blind a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Blind a) # shrink :: Blind a -> [Blind a] #
Enum a => Enum (Blind a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: Blind a -> Blind a # pred :: Blind a -> Blind a # toEnum :: Int -> Blind a # fromEnum :: Blind a -> Int # enumFrom :: Blind a -> [Blind a] # enumFromThen :: Blind a -> Blind a -> [Blind a] # enumFromTo :: Blind a -> Blind a -> [Blind a] # enumFromThenTo :: Blind a -> Blind a -> Blind a -> [Blind a] #
Num a => Num (Blind a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (+) :: Blind a -> Blind a -> Blind a # (-) :: Blind a -> Blind a -> Blind a # (*) :: Blind a -> Blind a -> Blind a # negate :: Blind a -> Blind a # abs :: Blind a -> Blind a # signum :: Blind a -> Blind a # fromInteger :: Integer -> Blind a #
Integral a => Integral (Blind a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods quot :: Blind a -> Blind a -> Blind a # rem :: Blind a -> Blind a -> Blind a # div :: Blind a -> Blind a -> Blind a # mod :: Blind a -> Blind a -> Blind a # quotRem :: Blind a -> Blind a -> (Blind a, Blind a) # divMod :: Blind a -> Blind a -> (Blind a, Blind a) # toInteger :: Blind a -> Integer #
Real a => Real (Blind a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods toRational :: Blind a -> Rational #
Show (Blind a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Blind a -> ShowS # show :: Blind a -> String # showList :: [Blind a] -> ShowS #
Eq a => Eq (Blind a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: Blind a -> Blind a -> Bool # (/=) :: Blind a -> Blind a -> Bool #
Ord a => Ord (Blind a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: Blind a -> Blind a -> Ordering # (<) :: Blind a -> Blind a -> Bool # (<=) :: Blind a -> Blind a -> Bool # (>) :: Blind a -> Blind a -> Bool # (>=) :: Blind a -> Blind a -> Bool # max :: Blind a -> Blind a -> Blind a # min :: Blind a -> Blind a -> Blind a #

newtype Fixed a #

`Fixed x`: as x, but will not be shrunk.

Constructors

Fixed |
Fields getFixed :: a

#### Instances

Instances details

Functor Fixed # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Fixed a -> Fixed b # (<$) :: a -> Fixed b -> Fixed a #
Arbitrary a => Arbitrary (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Fixed a) # shrink :: Fixed a -> [Fixed a] #
Enum a => Enum (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: Fixed a -> Fixed a # pred :: Fixed a -> Fixed a # toEnum :: Int -> Fixed a # fromEnum :: Fixed a -> Int # enumFrom :: Fixed a -> [Fixed a] # enumFromThen :: Fixed a -> Fixed a -> [Fixed a] # enumFromTo :: Fixed a -> Fixed a -> [Fixed a] # enumFromThenTo :: Fixed a -> Fixed a -> Fixed a -> [Fixed a] #
Num a => Num (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (+) :: Fixed a -> Fixed a -> Fixed a # (-) :: Fixed a -> Fixed a -> Fixed a # (*) :: Fixed a -> Fixed a -> Fixed a # negate :: Fixed a -> Fixed a # abs :: Fixed a -> Fixed a # signum :: Fixed a -> Fixed a # fromInteger :: Integer -> Fixed a #
Read a => Read (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (Fixed a) # readList :: ReadS [Fixed a] # readPrec :: ReadPrec (Fixed a) # readListPrec :: ReadPrec [Fixed a] #
Integral a => Integral (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods quot :: Fixed a -> Fixed a -> Fixed a # rem :: Fixed a -> Fixed a -> Fixed a # div :: Fixed a -> Fixed a -> Fixed a # mod :: Fixed a -> Fixed a -> Fixed a # quotRem :: Fixed a -> Fixed a -> (Fixed a, Fixed a) # divMod :: Fixed a -> Fixed a -> (Fixed a, Fixed a) # toInteger :: Fixed a -> Integer #
Real a => Real (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods toRational :: Fixed a -> Rational #
Show a => Show (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Fixed a -> ShowS # show :: Fixed a -> String # showList :: [Fixed a] -> ShowS #
Eq a => Eq (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: Fixed a -> Fixed a -> Bool # (/=) :: Fixed a -> Fixed a -> Bool #
Ord a => Ord (Fixed a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: Fixed a -> Fixed a -> Ordering # (<) :: Fixed a -> Fixed a -> Bool # (<=) :: Fixed a -> Fixed a -> Bool # (>) :: Fixed a -> Fixed a -> Bool # (>=) :: Fixed a -> Fixed a -> Bool # max :: Fixed a -> Fixed a -> Fixed a # min :: Fixed a -> Fixed a -> Fixed a #

newtype OrderedList a #

`Ordered xs`: guarantees that xs is ordered.

Constructors

Ordered |
Fields getOrdered :: [a]

#### Instances

Instances details

Functor OrderedList # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> OrderedList a -> OrderedList b # (<$) :: a -> OrderedList b -> OrderedList a #
(Ord a, Arbitrary a) => Arbitrary (OrderedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (OrderedList a) # shrink :: OrderedList a -> [OrderedList a] #
Read a => Read (OrderedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (OrderedList a) # readList :: ReadS [OrderedList a] # readPrec :: ReadPrec (OrderedList a) # readListPrec :: ReadPrec [OrderedList a] #
Show a => Show (OrderedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> OrderedList a -> ShowS # show :: OrderedList a -> String # showList :: [OrderedList a] -> ShowS #
Eq a => Eq (OrderedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: OrderedList a -> OrderedList a -> Bool # (/=) :: OrderedList a -> OrderedList a -> Bool #
Ord a => Ord (OrderedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: OrderedList a -> OrderedList a -> Ordering # (<) :: OrderedList a -> OrderedList a -> Bool # (<=) :: OrderedList a -> OrderedList a -> Bool # (>) :: OrderedList a -> OrderedList a -> Bool # (>=) :: OrderedList a -> OrderedList a -> Bool # max :: OrderedList a -> OrderedList a -> OrderedList a # min :: OrderedList a -> OrderedList a -> OrderedList a #

newtype NonEmptyList a #

`NonEmpty xs`: guarantees that xs is non-empty.

Constructors

NonEmpty |
Fields getNonEmpty :: [a]

#### Instances

Instances details

Functor NonEmptyList # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> NonEmptyList a -> NonEmptyList b # (<$) :: a -> NonEmptyList b -> NonEmptyList a #
Arbitrary a => Arbitrary (NonEmptyList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (NonEmptyList a) # shrink :: NonEmptyList a -> [NonEmptyList a] #
Read a => Read (NonEmptyList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (NonEmptyList a) # readList :: ReadS [NonEmptyList a] # readPrec :: ReadPrec (NonEmptyList a) # readListPrec :: ReadPrec [NonEmptyList a] #
Show a => Show (NonEmptyList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> NonEmptyList a -> ShowS # show :: NonEmptyList a -> String # showList :: [NonEmptyList a] -> ShowS #
Eq a => Eq (NonEmptyList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: NonEmptyList a -> NonEmptyList a -> Bool # (/=) :: NonEmptyList a -> NonEmptyList a -> Bool #
Ord a => Ord (NonEmptyList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: NonEmptyList a -> NonEmptyList a -> Ordering # (<) :: NonEmptyList a -> NonEmptyList a -> Bool # (<=) :: NonEmptyList a -> NonEmptyList a -> Bool # (>) :: NonEmptyList a -> NonEmptyList a -> Bool # (>=) :: NonEmptyList a -> NonEmptyList a -> Bool # max :: NonEmptyList a -> NonEmptyList a -> NonEmptyList a # min :: NonEmptyList a -> NonEmptyList a -> NonEmptyList a #

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" ++ ...

Constructors

InfiniteList |
Fields getInfiniteList :: [a] infiniteListInternalData :: InfiniteListInternalData a

#### Instances

Instances details

Arbitrary a => Arbitrary (InfiniteList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (InfiniteList a) # shrink :: InfiniteList a -> [InfiniteList a] #
Show a => Show (InfiniteList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> InfiniteList a -> ShowS # show :: InfiniteList a -> String # showList :: [InfiniteList a] -> ShowS #

newtype SortedList a #

`Sorted xs`: guarantees that xs is sorted.

Constructors

Sorted |
Fields getSorted :: [a]

#### Instances

Instances details

Functor SortedList # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> SortedList a -> SortedList b # (<$) :: a -> SortedList b -> SortedList a #
(Arbitrary a, Ord a) => Arbitrary (SortedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (SortedList a) # shrink :: SortedList a -> [SortedList a] #
Read a => Read (SortedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (SortedList a) # readList :: ReadS [SortedList a] # readPrec :: ReadPrec (SortedList a) # readListPrec :: ReadPrec [SortedList a] #
Show a => Show (SortedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> SortedList a -> ShowS # show :: SortedList a -> String # showList :: [SortedList a] -> ShowS #
Eq a => Eq (SortedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: SortedList a -> SortedList a -> Bool # (/=) :: SortedList a -> SortedList a -> Bool #
Ord a => Ord (SortedList a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: SortedList a -> SortedList a -> Ordering # (<) :: SortedList a -> SortedList a -> Bool # (<=) :: SortedList a -> SortedList a -> Bool # (>) :: SortedList a -> SortedList a -> Bool # (>=) :: SortedList a -> SortedList a -> Bool # max :: SortedList a -> SortedList a -> SortedList a # min :: SortedList a -> SortedList a -> SortedList a #

newtype Positive a #

`Positive x`: guarantees that `x > 0`.

Constructors

Positive |
Fields getPositive :: a

#### Instances

Instances details

Functor Positive # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Positive a -> Positive b # (<$) :: a -> Positive b -> Positive a #
(Num a, Ord a, Arbitrary a) => Arbitrary (Positive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Positive a) # shrink :: Positive a -> [Positive a] #
Enum a => Enum (Positive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: Positive a -> Positive a # pred :: Positive a -> Positive a # toEnum :: Int -> 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] #
Read a => Read (Positive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (Positive a) # readList :: ReadS [Positive a] # readPrec :: ReadPrec (Positive a) # readListPrec :: ReadPrec [Positive a] #
Show a => Show (Positive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Positive a -> ShowS # show :: Positive a -> String # showList :: [Positive a] -> ShowS #
Eq a => Eq (Positive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: Positive a -> Positive a -> Bool # (/=) :: Positive a -> Positive a -> Bool #
Ord a => Ord (Positive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: Positive a -> Positive a -> Ordering # (<) :: Positive a -> Positive a -> Bool # (<=) :: Positive a -> Positive a -> Bool # (>) :: Positive a -> Positive a -> Bool # (>=) :: Positive a -> Positive a -> Bool # max :: Positive a -> Positive a -> Positive a # min :: Positive a -> Positive a -> Positive a #

newtype Negative a #

`Negative x`: guarantees that `x < 0`.

Constructors

Negative |
Fields getNegative :: a

#### Instances

Instances details

Functor Negative # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Negative a -> Negative b # (<$) :: a -> Negative b -> Negative a #
(Num a, Ord a, Arbitrary a) => Arbitrary (Negative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Negative a) # shrink :: Negative a -> [Negative a] #
Enum a => Enum (Negative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: Negative a -> Negative a # pred :: Negative a -> Negative a # toEnum :: Int -> 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] #
Read a => Read (Negative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (Negative a) # readList :: ReadS [Negative a] # readPrec :: ReadPrec (Negative a) # readListPrec :: ReadPrec [Negative a] #
Show a => Show (Negative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Negative a -> ShowS # show :: Negative a -> String # showList :: [Negative a] -> ShowS #
Eq a => Eq (Negative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: Negative a -> Negative a -> Bool # (/=) :: Negative a -> Negative a -> Bool #
Ord a => Ord (Negative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: Negative a -> Negative a -> Ordering # (<) :: Negative a -> Negative a -> Bool # (<=) :: Negative a -> Negative a -> Bool # (>) :: Negative a -> Negative a -> Bool # (>=) :: Negative a -> Negative a -> Bool # max :: Negative a -> Negative a -> Negative a # min :: Negative a -> Negative a -> Negative a #

newtype NonZero a #

`NonZero x`: guarantees that `x /= 0`.

Constructors

NonZero |
Fields getNonZero :: a

#### Instances

Instances details

Functor NonZero # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> NonZero a -> NonZero b # (<$) :: a -> NonZero b -> NonZero a #
(Num a, Eq a, Arbitrary a) => Arbitrary (NonZero a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (NonZero a) # shrink :: NonZero a -> [NonZero a] #
Enum a => Enum (NonZero a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: NonZero a -> NonZero a # pred :: NonZero a -> NonZero a # toEnum :: Int -> 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] #
Read a => Read (NonZero a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (NonZero a) # readList :: ReadS [NonZero a] # readPrec :: ReadPrec (NonZero a) # readListPrec :: ReadPrec [NonZero a] #
Show a => Show (NonZero a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> NonZero a -> ShowS # show :: NonZero a -> String # showList :: [NonZero a] -> ShowS #
Eq a => Eq (NonZero a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: NonZero a -> NonZero a -> Bool # (/=) :: NonZero a -> NonZero a -> Bool #
Ord a => Ord (NonZero a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: NonZero a -> NonZero a -> Ordering # (<) :: NonZero a -> NonZero a -> Bool # (<=) :: NonZero a -> NonZero a -> Bool # (>) :: NonZero a -> NonZero a -> Bool # (>=) :: NonZero a -> NonZero a -> Bool # max :: NonZero a -> NonZero a -> NonZero a # min :: NonZero a -> NonZero a -> NonZero a #

newtype NonNegative a #

`NonNegative x`: guarantees that `x >= 0`.

Constructors

NonNegative |
Fields getNonNegative :: a

#### Instances

Instances details

Functor NonNegative # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> NonNegative a -> NonNegative b # (<$) :: a -> NonNegative b -> NonNegative a #
(Num a, Ord a, Arbitrary a) => Arbitrary (NonNegative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (NonNegative a) # shrink :: NonNegative a -> [NonNegative a] #
Enum a => Enum (NonNegative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: NonNegative a -> NonNegative a # pred :: NonNegative a -> NonNegative a # toEnum :: Int -> NonNegative a # fromEnum :: NonNegative a -> Int # enumFrom :: NonNegative a -> [NonNegative a] # enumFromThen :: NonNegative a -> NonNegative a -> [NonNegative a] # enumFromTo :: NonNegative a -> NonNegative a -> [NonNegative a] # enumFromThenTo :: NonNegative a -> NonNegative a -> NonNegative a -> [NonNegative a] #
Read a => Read (NonNegative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (NonNegative a) # readList :: ReadS [NonNegative a] # readPrec :: ReadPrec (NonNegative a) # readListPrec :: ReadPrec [NonNegative a] #
Show a => Show (NonNegative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> NonNegative a -> ShowS # show :: NonNegative a -> String # showList :: [NonNegative a] -> ShowS #
Eq a => Eq (NonNegative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: NonNegative a -> NonNegative a -> Bool # (/=) :: NonNegative a -> NonNegative a -> Bool #
Ord a => Ord (NonNegative a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: NonNegative a -> NonNegative a -> Ordering # (<) :: NonNegative a -> NonNegative a -> Bool # (<=) :: NonNegative a -> NonNegative a -> Bool # (>) :: NonNegative a -> NonNegative a -> Bool # (>=) :: NonNegative a -> NonNegative a -> Bool # max :: NonNegative a -> NonNegative a -> NonNegative a # min :: NonNegative a -> NonNegative a -> NonNegative a #

newtype NonPositive a #

`NonPositive x`: guarantees that `x <= 0`.

Constructors

NonPositive |
Fields getNonPositive :: a

#### Instances

Instances details

Functor NonPositive # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> NonPositive a -> NonPositive b # (<$) :: a -> NonPositive b -> NonPositive a #
(Num a, Ord a, Arbitrary a) => Arbitrary (NonPositive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (NonPositive a) # shrink :: NonPositive a -> [NonPositive a] #
Enum a => Enum (NonPositive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: NonPositive a -> NonPositive a # pred :: NonPositive a -> NonPositive a # toEnum :: Int -> NonPositive a # fromEnum :: NonPositive a -> Int # enumFrom :: NonPositive a -> [NonPositive a] # enumFromThen :: NonPositive a -> NonPositive a -> [NonPositive a] # enumFromTo :: NonPositive a -> NonPositive a -> [NonPositive a] # enumFromThenTo :: NonPositive a -> NonPositive a -> NonPositive a -> [NonPositive a] #
Read a => Read (NonPositive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (NonPositive a) # readList :: ReadS [NonPositive a] # readPrec :: ReadPrec (NonPositive a) # readListPrec :: ReadPrec [NonPositive a] #
Show a => Show (NonPositive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> NonPositive a -> ShowS # show :: NonPositive a -> String # showList :: [NonPositive a] -> ShowS #
Eq a => Eq (NonPositive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: NonPositive a -> NonPositive a -> Bool # (/=) :: NonPositive a -> NonPositive a -> Bool #
Ord a => Ord (NonPositive a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: NonPositive a -> NonPositive a -> Ordering # (<) :: NonPositive a -> NonPositive a -> Bool # (<=) :: NonPositive a -> NonPositive a -> Bool # (>) :: NonPositive a -> NonPositive a -> Bool # (>=) :: NonPositive a -> NonPositive a -> Bool # max :: NonPositive a -> NonPositive a -> NonPositive a # min :: NonPositive a -> NonPositive a -> NonPositive a #

newtype Large a #

`Large x`: by default, QuickCheck generates `Int`s drawn from a small range. `Large Int` gives you values drawn from the entire range instead.

Constructors

Large |
Fields getLarge :: a

#### Instances

Instances details

Functor Large # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Large a -> Large b # (<$) :: a -> Large b -> Large a #
(Integral a, Bounded a) => Arbitrary (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Large a) # shrink :: Large a -> [Large a] #
Enum a => Enum (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: Large a -> Large a # pred :: Large a -> Large a # toEnum :: Int -> Large a # fromEnum :: Large a -> Int # enumFrom :: Large a -> [Large a] # enumFromThen :: Large a -> Large a -> [Large a] # enumFromTo :: Large a -> Large a -> [Large a] # enumFromThenTo :: Large a -> Large a -> Large a -> [Large a] #
Ix a => Ix (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods range :: (Large a, Large a) -> [Large a] # index :: (Large a, Large a) -> Large a -> Int # unsafeIndex :: (Large a, Large a) -> Large a -> Int # inRange :: (Large a, Large a) -> Large a -> Bool # rangeSize :: (Large a, Large a) -> Int # unsafeRangeSize :: (Large a, Large a) -> Int #
Num a => Num (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (+) :: Large a -> Large a -> Large a # (-) :: Large a -> Large a -> Large a # (*) :: Large a -> Large a -> Large a # negate :: Large a -> Large a # abs :: Large a -> Large a # signum :: Large a -> Large a # fromInteger :: Integer -> Large a #
Read a => Read (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (Large a) # readList :: ReadS [Large a] # readPrec :: ReadPrec (Large a) # readListPrec :: ReadPrec [Large a] #
Integral a => Integral (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods quot :: Large a -> Large a -> Large a # rem :: Large a -> Large a -> Large a # div :: Large a -> Large a -> Large a # mod :: Large a -> Large a -> Large a # quotRem :: Large a -> Large a -> (Large a, Large a) # divMod :: Large a -> Large a -> (Large a, Large a) # toInteger :: Large a -> Integer #
Real a => Real (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods toRational :: Large a -> Rational #
Show a => Show (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Large a -> ShowS # show :: Large a -> String # showList :: [Large a] -> ShowS #
Eq a => Eq (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: Large a -> Large a -> Bool # (/=) :: Large a -> Large a -> Bool #
Ord a => Ord (Large a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: Large a -> Large a -> Ordering # (<) :: Large a -> Large a -> Bool # (<=) :: Large a -> Large a -> Bool # (>) :: Large a -> Large a -> Bool # (>=) :: Large a -> Large a -> Bool # max :: Large a -> Large a -> Large a # min :: Large a -> Large a -> Large a #

newtype Small a #

`Small x`: generates values of `x` drawn from a small range. The opposite of `Large`.

Constructors

Small |
Fields getSmall :: a

#### Instances

Instances details

Functor Small # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Small a -> Small b # (<$) :: a -> Small b -> Small a #
Integral a => Arbitrary (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Small a) # shrink :: Small a -> [Small a] #
Enum a => Enum (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: Small a -> Small a # pred :: Small a -> Small a # toEnum :: Int -> Small a # fromEnum :: Small a -> Int # enumFrom :: Small a -> [Small a] # enumFromThen :: Small a -> Small a -> [Small a] # enumFromTo :: Small a -> Small a -> [Small a] # enumFromThenTo :: Small a -> Small a -> Small a -> [Small a] #
Ix a => Ix (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods range :: (Small a, Small a) -> [Small a] # index :: (Small a, Small a) -> Small a -> Int # unsafeIndex :: (Small a, Small a) -> Small a -> Int # inRange :: (Small a, Small a) -> Small a -> Bool # rangeSize :: (Small a, Small a) -> Int # unsafeRangeSize :: (Small a, Small a) -> Int #
Num a => Num (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (+) :: Small a -> Small a -> Small a # (-) :: Small a -> Small a -> Small a # (*) :: Small a -> Small a -> Small a # negate :: Small a -> Small a # abs :: Small a -> Small a # signum :: Small a -> Small a # fromInteger :: Integer -> Small a #
Read a => Read (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (Small a) # readList :: ReadS [Small a] # readPrec :: ReadPrec (Small a) # readListPrec :: ReadPrec [Small a] #
Integral a => Integral (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods quot :: Small a -> Small a -> Small a # rem :: Small a -> Small a -> Small a # div :: Small a -> Small a -> Small a # mod :: Small a -> Small a -> Small a # quotRem :: Small a -> Small a -> (Small a, Small a) # divMod :: Small a -> Small a -> (Small a, Small a) # toInteger :: Small a -> Integer #
Real a => Real (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods toRational :: Small a -> Rational #
Show a => Show (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Small a -> ShowS # show :: Small a -> String # showList :: [Small a] -> ShowS #
Eq a => Eq (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: Small a -> Small a -> Bool # (/=) :: Small a -> Small a -> Bool #
Ord a => Ord (Small a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: Small a -> Small a -> Ordering # (<) :: Small a -> Small a -> Bool # (<=) :: Small a -> Small a -> Bool # (>) :: Small a -> Small a -> Bool # (>=) :: Small a -> Small a -> Bool # max :: Small a -> Small a -> Small a # min :: Small a -> Small a -> Small a #

data Smart a #

`Smart _ x`: tries a different order when shrinking.

Constructors

Smart Int a |

#### Instances

Instances details

Functor Smart # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Smart a -> Smart b # (<$) :: a -> Smart b -> Smart a #
Arbitrary a => Arbitrary (Smart a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Smart a) # shrink :: Smart a -> [Smart a] #
Show a => Show (Smart a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Smart a -> ShowS # show :: Smart a -> String # showList :: [Smart a] -> ShowS #

newtype Shrink2 a #

`Shrink2 x`: allows 2 shrinking steps at the same time when shrinking x

Constructors

Shrink2 |
Fields getShrink2 :: a

#### Instances

Instances details

Functor Shrink2 # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Shrink2 a -> Shrink2 b # (<$) :: a -> Shrink2 b -> Shrink2 a #
Arbitrary a => Arbitrary (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Shrink2 a) # shrink :: Shrink2 a -> [Shrink2 a] #
Enum a => Enum (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods succ :: Shrink2 a -> Shrink2 a # pred :: Shrink2 a -> Shrink2 a # toEnum :: Int -> 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] #
Num a => Num (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (+) :: Shrink2 a -> Shrink2 a -> Shrink2 a # (-) :: Shrink2 a -> Shrink2 a -> Shrink2 a # (*) :: Shrink2 a -> Shrink2 a -> Shrink2 a # negate :: Shrink2 a -> Shrink2 a # abs :: Shrink2 a -> Shrink2 a # signum :: Shrink2 a -> Shrink2 a # fromInteger :: Integer -> Shrink2 a #
Read a => Read (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS (Shrink2 a) # readList :: ReadS [Shrink2 a] # readPrec :: ReadPrec (Shrink2 a) # readListPrec :: ReadPrec [Shrink2 a] #
Integral a => Integral (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods quot :: Shrink2 a -> Shrink2 a -> Shrink2 a # rem :: Shrink2 a -> Shrink2 a -> Shrink2 a # div :: Shrink2 a -> Shrink2 a -> Shrink2 a # mod :: Shrink2 a -> Shrink2 a -> Shrink2 a # quotRem :: Shrink2 a -> Shrink2 a -> (Shrink2 a, Shrink2 a) # divMod :: Shrink2 a -> Shrink2 a -> (Shrink2 a, Shrink2 a) # toInteger :: Shrink2 a -> Integer #
Real a => Real (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods toRational :: Shrink2 a -> Rational #
Show a => Show (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Shrink2 a -> ShowS # show :: Shrink2 a -> String # showList :: [Shrink2 a] -> ShowS #
Eq a => Eq (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: Shrink2 a -> Shrink2 a -> Bool # (/=) :: Shrink2 a -> Shrink2 a -> Bool #
Ord a => Ord (Shrink2 a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: Shrink2 a -> Shrink2 a -> Ordering # (<) :: Shrink2 a -> Shrink2 a -> Bool # (<=) :: Shrink2 a -> Shrink2 a -> Bool # (>) :: Shrink2 a -> Shrink2 a -> Bool # (>=) :: Shrink2 a -> Shrink2 a -> Bool # max :: Shrink2 a -> Shrink2 a -> Shrink2 a # min :: Shrink2 a -> Shrink2 a -> Shrink2 a #

data Shrinking s a #

`Shrinking _ x`: allows for maintaining a state during shrinking.

Constructors

Shrinking s a |

#### Instances

Instances details

Functor (Shrinking s) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods fmap :: (a -> b) -> Shrinking s a -> Shrinking s b # (<$) :: a -> Shrinking s b -> Shrinking s a #
(Arbitrary a, ShrinkState s a) => Arbitrary (Shrinking s a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen (Shrinking s a) # shrink :: Shrinking s a -> [Shrinking s a] #
Show a => Show (Shrinking s a) # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> Shrinking s a -> ShowS # show :: Shrinking s a -> String # showList :: [Shrinking s a] -> ShowS #

class ShrinkState s a where #

Methods

shrinkInit :: a -> s #

shrinkState :: a -> s -> [(a, s)] #

newtype ASCIIString #

`ASCIIString`: generates an ASCII string.

Constructors

ASCIIString |
Fields getASCIIString :: String

#### Instances

Instances details

Arbitrary ASCIIString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen ASCIIString # shrink :: ASCIIString -> [ASCIIString] #
Read ASCIIString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS ASCIIString # readList :: ReadS [ASCIIString] # readPrec :: ReadPrec ASCIIString # readListPrec :: ReadPrec [ASCIIString] #
Show ASCIIString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> ASCIIString -> ShowS # show :: ASCIIString -> String # showList :: [ASCIIString] -> ShowS #
Eq ASCIIString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: ASCIIString -> ASCIIString -> Bool # (/=) :: ASCIIString -> ASCIIString -> Bool #
Ord ASCIIString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: ASCIIString -> ASCIIString -> Ordering # (<) :: ASCIIString -> ASCIIString -> Bool # (<=) :: ASCIIString -> ASCIIString -> Bool # (>) :: ASCIIString -> ASCIIString -> Bool # (>=) :: ASCIIString -> ASCIIString -> Bool # max :: ASCIIString -> ASCIIString -> ASCIIString # min :: ASCIIString -> ASCIIString -> ASCIIString #

newtype UnicodeString #

`UnicodeString`: generates a unicode String. The string will not contain surrogate pairs.

Constructors

UnicodeString |
Fields getUnicodeString :: String

#### Instances

Instances details

Arbitrary UnicodeString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen UnicodeString # shrink :: UnicodeString -> [UnicodeString] #
Read UnicodeString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS UnicodeString # readList :: ReadS [UnicodeString] # readPrec :: ReadPrec UnicodeString # readListPrec :: ReadPrec [UnicodeString] #
Show UnicodeString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> UnicodeString -> ShowS # show :: UnicodeString -> String # showList :: [UnicodeString] -> ShowS #
Eq UnicodeString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: UnicodeString -> UnicodeString -> Bool # (/=) :: UnicodeString -> UnicodeString -> Bool #
Ord UnicodeString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: UnicodeString -> UnicodeString -> Ordering # (<) :: UnicodeString -> UnicodeString -> Bool # (<=) :: UnicodeString -> UnicodeString -> Bool # (>) :: UnicodeString -> UnicodeString -> Bool # (>=) :: UnicodeString -> UnicodeString -> Bool # max :: UnicodeString -> UnicodeString -> UnicodeString # min :: UnicodeString -> UnicodeString -> UnicodeString #

newtype PrintableString #

`PrintableString`: generates a printable unicode String. The string will not contain surrogate pairs.

Constructors

PrintableString |
Fields getPrintableString :: String

#### Instances

Instances details

Arbitrary PrintableString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods arbitrary :: Gen PrintableString # shrink :: PrintableString -> [PrintableString] #
Read PrintableString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods readsPrec :: Int -> ReadS PrintableString # readList :: ReadS [PrintableString] # readPrec :: ReadPrec PrintableString # readListPrec :: ReadPrec [PrintableString] #
Show PrintableString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods showsPrec :: Int -> PrintableString -> ShowS # show :: PrintableString -> String # showList :: [PrintableString] -> ShowS #
Eq PrintableString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods (==) :: PrintableString -> PrintableString -> Bool # (/=) :: PrintableString -> PrintableString -> Bool #
Ord PrintableString # |
Instance details Defined in Test.QuickCheck.Modifiers Methods compare :: PrintableString -> PrintableString -> Ordering # (<) :: PrintableString -> PrintableString -> Bool # (<=) :: PrintableString -> PrintableString -> Bool # (>) :: PrintableString -> PrintableString -> Bool # (>=) :: PrintableString -> PrintableString -> Bool # max :: PrintableString -> PrintableString -> PrintableString # min :: PrintableString -> PrintableString -> PrintableString #