genvalidity-hspec-1.0.0.3: Standard spec's for GenValidity instances
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Validity.Functor

Description

Functor properties

You will need TypeApplications to use these.

Synopsis

Documentation

functorSpec :: forall (f :: Type -> Type). (Eq (f Int), Show (f Int), Functor f, Typeable f, GenValid (f Int)) => Spec Source #

Standard test spec for properties of Functor instances for values generated with GenValid instances

Example usage:

functorSpecOnArbitrary @[]

functorSpecOnArbitrary :: forall (f :: Type -> Type). (Eq (f Int), Show (f Int), Functor f, Typeable f, Arbitrary (f Int)) => Spec Source #

Standard test spec for properties of Functor instances for values generated with Arbitrary instances

Example usage:

functorSpecOnArbitrary @[]

functorSpecOnGens :: forall (f :: Type -> Type) (a :: Type) (b :: Type) (c :: Type). (Show a, Show (f a), Show (f c), Eq (f a), Eq (f c), Functor f, Typeable f, Typeable a, Typeable b, Typeable c) => Gen a -> String -> Gen (f a) -> String -> Gen (b -> c) -> String -> Gen (a -> b) -> String -> Spec Source #

Standard test spec for properties of Functor instances for values generated by given generators (and names for those generator).

Example usage:

functorSpecOnGens
    @[]
    @Int
    (pure 4) "four"
    (genListOf $ pure 5) "list of fives"
    ((+) <$> genValid) "additions"
    ((*) <$> genValid) "multiplications"