| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Syd.Validity.Applicative
Description
Applicative properties
You will need TypeApplications to use these.
Synopsis
- applicativeSpecOnValid :: forall (f :: Type -> Type). (Eq (f Int), Show (f Int), Applicative f, Typeable f, GenValid (f Int)) => Spec
- applicativeSpec :: forall (f :: Type -> Type). (Eq (f Int), Show (f Int), Applicative f, Typeable f, GenUnchecked (f Int)) => Spec
- applicativeSpecOnArbitrary :: forall (f :: Type -> Type). (Eq (f Int), Show (f Int), Applicative f, Typeable f, Arbitrary (f Int)) => Spec
- applicativeSpecOnGens :: forall (f :: Type -> Type) (a :: Type) (b :: Type) (c :: Type). (Show a, Show (f a), Eq (f a), Show (f b), Eq (f b), Show (f c), Eq (f c), Applicative f, Typeable f, Typeable a, Typeable b, Typeable c) => Gen a -> String -> Gen (f a) -> String -> Gen (f b) -> String -> Gen (a -> b) -> String -> Gen (f (a -> b)) -> String -> Gen (f (b -> c)) -> String -> Spec
Documentation
applicativeSpecOnValid :: forall (f :: Type -> Type). (Eq (f Int), Show (f Int), Applicative f, Typeable f, GenValid (f Int)) => Spec Source #
Standard test spec for properties of Applicative instances for values generated with GenValid instances
Example usage:
applicativeSpecOnArbitrary @[]
applicativeSpec :: forall (f :: Type -> Type). (Eq (f Int), Show (f Int), Applicative f, Typeable f, GenUnchecked (f Int)) => Spec Source #
Standard test spec for properties of Applicative instances for values generated with GenUnchecked instances
Example usage:
applicativeSpecOnArbitrary @[]
applicativeSpecOnArbitrary :: forall (f :: Type -> Type). (Eq (f Int), Show (f Int), Applicative f, Typeable f, Arbitrary (f Int)) => Spec Source #
Standard test spec for properties of Applicative instances for values generated with Arbitrary instances
Example usage:
applicativeSpecOnArbitrary @[]
applicativeSpecOnGens :: forall (f :: Type -> Type) (a :: Type) (b :: Type) (c :: Type). (Show a, Show (f a), Eq (f a), Show (f b), Eq (f b), Show (f c), Eq (f c), Applicative f, Typeable f, Typeable a, Typeable b, Typeable c) => Gen a -> String -> Gen (f a) -> String -> Gen (f b) -> String -> Gen (a -> b) -> String -> Gen (f (a -> b)) -> String -> Gen (f (b -> c)) -> String -> Spec Source #
Standard test spec for properties of Applicative instances for values generated by given generators (and names for those generator).
Unless you are building a specific regression test, you probably want to use the other applicativeSpec functions.
Example usage:
applicativeSpecOnGens
@Maybe
@String
(pure "ABC")
"ABC"
(Just <$> pure "ABC")
"Just an ABC"
(pure Nothing)
"purely Nothing"
((++) <$> genValid)
"prepends"
(pure <$> ((++) <$> genValid))
"prepends in a Just"
(pure <$> (flip (++) <$> genValid))
"appends in a Just"