newtype Blind a
Blind x: as x, but x does not have to be in the Show class.
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 :: ['Test.QuickCheck.Poly.A']) =
takeWhile p xs ++ dropWhile p xs == xs
prop_TakeDrop ('NonNegative' n) (xs :: ['Test.QuickCheck.Poly.A']) =
take n xs ++ drop n xs == xs
-- cycle does not work for empty lists
prop_Cycle ('NonNegative' n) ('NonEmpty' (xs :: ['Test.QuickCheck.Poly.A'])) =
take n (cycle xs) == take n (xs ++ cycle xs)
-- Instead of 'Test.QuickCheck.forAll' 'orderedList'
prop_Sort ('Ordered' (xs :: ['Test.QuickCheck.Poly.OrdA'])) =
sort xs == xs
newtype Blind aBlind x: as x, but x does not have to be in the Show class.
Blind :: a -> Blind agetBlind :: Blind a -> anewtype Fixed aFixed x: as x, but will not be shrunk.
Fixed :: a -> Fixed agetFixed :: Fixed a -> anewtype OrderedList aOrdered xs: guarantees that xs is ordered.
Ordered :: [a] -> OrderedList agetOrdered :: OrderedList a -> [a]newtype NonEmptyList aNonEmpty xs: guarantees that xs is non-empty.
NonEmpty :: [a] -> NonEmptyList agetNonEmpty :: NonEmptyList a -> [a]data InfiniteList aInfiniteList 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:
InfiniteList :: [a] -> InfiniteListInternalData a -> InfiniteList agetInfiniteList :: InfiniteList a -> [a]infiniteListInternalData :: InfiniteList a -> InfiniteListInternalData anewtype SortedList aSorted xs: guarantees that xs is sorted.
Sorted :: [a] -> SortedList agetSorted :: SortedList a -> [a]newtype Positive aPositive x: guarantees that x > 0.
Positive :: a -> Positive agetPositive :: Positive a -> anewtype Negative aNegative x: guarantees that x < 0.
Negative :: a -> Negative agetNegative :: Negative a -> anewtype NonZero aNonZero x: guarantees that x /= 0.
NonZero :: a -> NonZero agetNonZero :: NonZero a -> anewtype NonNegative aNonNegative x: guarantees that x >= 0.
NonNegative :: a -> NonNegative agetNonNegative :: NonNegative a -> anewtype NonPositive aNonPositive x: guarantees that x <= 0.
NonPositive :: a -> NonPositive agetNonPositive :: NonPositive a -> anewtype Large aLarge x: by default, QuickCheck generates Ints drawn from a small
range. Large Int gives you values drawn from the entire range instead.
Large :: a -> Large agetLarge :: Large a -> anewtype Small aSmall x: generates values of x drawn from a small range.
The opposite of Large.
Small :: a -> Small agetSmall :: Small a -> adata Smart aSmart _ x: tries a different order when shrinking.
Smart :: Int -> a -> Smart anewtype Shrink2 aShrink2 x: allows 2 shrinking steps at the same time when shrinking x
Shrink2 :: a -> Shrink2 agetShrink2 :: Shrink2 a -> anewtype NoShrink aNoShrink x: no shrinking
NoShrink :: a -> NoShrink agetNoShrink :: NoShrink a -> adata Shrinking s aShrinking _ x: allows for maintaining a state during shrinking.
Shrinking :: s -> a -> Shrinking s aclass ShrinkState s ashrinkInit :: a -> sshrinkState :: a -> s -> [(a, s)]newtype ASCIIStringASCIIString: generates an ASCII string.
ASCIIString :: String -> ASCIIStringgetASCIIString :: ASCIIString -> Stringnewtype UnicodeStringUnicodeString: generates a unicode String.
The string will not contain surrogate pairs.
UnicodeString :: String -> UnicodeStringgetUnicodeString :: UnicodeString -> Stringnewtype PrintableStringPrintableString: generates a printable unicode String.
The string will not contain surrogate pairs.
PrintableString :: String -> PrintableStringgetPrintableString :: PrintableString -> Stringinstance Eq a => Eq (Blind a)instance Ord a => Ord (Blind a)instance Num a => Num (Blind a)instance Integral a => Integral (Blind a)instance Real a => Real (Blind a)instance Enum a => Enum (Blind a)instance Typeable a => Typeable (Blind a)instance Functor Blindinstance Show (Blind a)instance Arbitrary a => Arbitrary (Blind a)instance Eq a => Eq (Fixed a)instance Ord a => Ord (Fixed a)instance Show a => Show (Fixed a)instance Read a => Read (Fixed a)instance Num a => Num (Fixed a)instance Integral a => Integral (Fixed a)instance Real a => Real (Fixed a)instance Enum a => Enum (Fixed a)instance Typeable a => Typeable (Fixed a)instance Functor Fixedinstance Arbitrary a => Arbitrary (Fixed a)instance Eq a => Eq (OrderedList a)instance Ord a => Ord (OrderedList a)instance Show a => Show (OrderedList a)instance Read a => Read (OrderedList a)instance Typeable a => Typeable (OrderedList a)instance Functor OrderedListinstance (Ord a, Arbitrary a) => Arbitrary (OrderedList a)instance Eq a => Eq (NonEmptyList a)instance Ord a => Ord (NonEmptyList a)instance Show a => Show (NonEmptyList a)instance Read a => Read (NonEmptyList a)instance Typeable a => Typeable (NonEmptyList a)instance Functor NonEmptyListinstance Arbitrary1 NonEmptyListinstance Arbitrary a => Arbitrary (NonEmptyList a)instance Show a => Show (InfiniteList a)instance Arbitrary a => Arbitrary (InfiniteList a)instance Arbitrary a => Arbitrary (InfiniteListInternalData a)instance Eq a => Eq (SortedList a)instance Ord a => Ord (SortedList a)instance Show a => Show (SortedList a)instance Read a => Read (SortedList a)instance Typeable a => Typeable (SortedList a)instance Functor SortedListinstance (Arbitrary a, Ord a) => Arbitrary (SortedList a)instance Eq a => Eq (Positive a)instance Ord a => Ord (Positive a)instance Show a => Show (Positive a)instance Read a => Read (Positive a)instance Enum a => Enum (Positive a)instance Typeable a => Typeable (Positive a)instance Functor Positiveinstance (Num a, Ord a, Arbitrary a) => Arbitrary (Positive a)instance Eq a => Eq (Negative a)instance Ord a => Ord (Negative a)instance Show a => Show (Negative a)instance Read a => Read (Negative a)instance Enum a => Enum (Negative a)instance Typeable a => Typeable (Negative a)instance Functor Negativeinstance (Num a, Ord a, Arbitrary a) => Arbitrary (Negative a)instance Eq a => Eq (NonZero a)instance Ord a => Ord (NonZero a)instance Show a => Show (NonZero a)instance Read a => Read (NonZero a)instance Enum a => Enum (NonZero a)instance Typeable a => Typeable (NonZero a)instance Functor NonZeroinstance (Num a, Eq a, Arbitrary a) => Arbitrary (NonZero a)instance Eq a => Eq (NonNegative a)instance Ord a => Ord (NonNegative a)instance Show a => Show (NonNegative a)instance Read a => Read (NonNegative a)instance Enum a => Enum (NonNegative a)instance Typeable a => Typeable (NonNegative a)instance Functor NonNegativeinstance (Num a, Ord a, Arbitrary a) => Arbitrary (NonNegative a)instance Eq a => Eq (NonPositive a)instance Ord a => Ord (NonPositive a)instance Show a => Show (NonPositive a)instance Read a => Read (NonPositive a)instance Enum a => Enum (NonPositive a)instance Typeable a => Typeable (NonPositive a)instance Functor NonPositiveinstance (Num a, Ord a, Arbitrary a) => Arbitrary (NonPositive a)instance Eq a => Eq (Large a)instance Ord a => Ord (Large a)instance Show a => Show (Large a)instance Read a => Read (Large a)instance Num a => Num (Large a)instance Integral a => Integral (Large a)instance Real a => Real (Large a)instance Enum a => Enum (Large a)instance Ix a => Ix (Large a)instance Typeable a => Typeable (Large a)instance Functor Largeinstance (Integral a, Bounded a) => Arbitrary (Large a)instance Eq a => Eq (Small a)instance Ord a => Ord (Small a)instance Show a => Show (Small a)instance Read a => Read (Small a)instance Num a => Num (Small a)instance Integral a => Integral (Small a)instance Real a => Real (Small a)instance Enum a => Enum (Small a)instance Ix a => Ix (Small a)instance Typeable a => Typeable (Small a)instance Functor Smallinstance Integral a => Arbitrary (Small a)instance Eq a => Eq (Shrink2 a)instance Ord a => Ord (Shrink2 a)instance Show a => Show (Shrink2 a)instance Read a => Read (Shrink2 a)instance Num a => Num (Shrink2 a)instance Integral a => Integral (Shrink2 a)instance Real a => Real (Shrink2 a)instance Enum a => Enum (Shrink2 a)instance Typeable a => Typeable (Shrink2 a)instance Functor Shrink2instance Arbitrary a => Arbitrary (Shrink2 a)instance Eq a => Eq (NoShrink a)instance Ord a => Ord (NoShrink a)instance Show a => Show (NoShrink a)instance Read a => Read (NoShrink a)instance Num a => Num (NoShrink a)instance Integral a => Integral (NoShrink a)instance Real a => Real (NoShrink a)instance Enum a => Enum (NoShrink a)instance Ix a => Ix (NoShrink a)instance Typeable a => Typeable (NoShrink a)instance Functor NoShrinkinstance Arbitrary a => Arbitrary (NoShrink a)instance Functor Smartinstance Show a => Show (Smart a)instance Arbitrary a => Arbitrary (Smart a)instance Functor (Shrinking s)instance Show a => Show (Shrinking s a)instance (Arbitrary a, ShrinkState s a) => Arbitrary (Shrinking s a)instance Eq ASCIIStringinstance Ord ASCIIStringinstance Show ASCIIStringinstance Read ASCIIStringinstance Typeable ASCIIStringinstance Arbitrary ASCIIStringinstance Eq UnicodeStringinstance Ord UnicodeStringinstance Show UnicodeStringinstance Read UnicodeStringinstance Typeable UnicodeStringinstance Arbitrary UnicodeStringinstance Eq PrintableStringinstance Ord PrintableStringinstance Show PrintableStringinstance Read PrintableStringinstance Typeable PrintableStringinstance Arbitrary PrintableStringCommunity contribution. The service has not verified this documentation. The generator reported 30 diagnostics.
Target: Linux on x86-64. Some inferred types and resolved links are not available.
Generator: aihc-haddock-aa6debbd-web-3
Metadata snapshot: f17ab6aeb2a7b6daf9fba7614097e138beeef85fa92c3fb7fdfed9ed0e49728c
Open the dependency plan · Download the documentation model