genvalidity-hspec-0.6.2.3: Standard spec's for GenValidity instances

Safe Haskell | None
Language | Haskell2010

Test.Validity.Monad

Description

Monad properties

You will need `TypeApplications` to use these.

Synopsis

- monadSpecOnValid :: forall (f :: * -> *). (Eq (f Int), Show (f Int), Monad f, Typeable f, GenValid (f Int)) => Spec
- monadSpec :: forall (f :: * -> *). (Eq (f Int), Show (f Int), Monad f, Typeable f, GenUnchecked (f Int)) => Spec
- monadSpecOnArbitrary :: forall (f :: * -> *). (Eq (f Int), Show (f Int), Monad f, Typeable f, Arbitrary (f Int)) => Spec
- monadSpecOnGens :: forall (f :: * -> *) (a :: *) (b :: *) (c :: *). (Show a, Eq a, Show (f a), Show (f b), Show (f c), Eq (f a), Eq (f b), Eq (f c), Monad 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 (a -> f b) -> String -> Gen (b -> f c) -> String -> Gen (f (a -> b)) -> String -> Spec

# Documentation

monadSpecOnValid :: forall (f :: * -> *). (Eq (f Int), Show (f Int), Monad f, Typeable f, GenValid (f Int)) => Spec Source #

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

Example usage:

    monadSpecOnValid @[]

monadSpec :: forall (f :: * -> *). (Eq (f Int), Show (f Int), Monad f, Typeable f, GenUnchecked (f Int)) => Spec Source #

Standard test spec for properties of Monad instances for values generated with GenUnchecked instances

Example usage:

    monadSpec @[]

monadSpecOnArbitrary :: forall (f :: * -> *). (Eq (f Int), Show (f Int), Monad f, Typeable f, Arbitrary (f Int)) => Spec Source #

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

Example usage:

    monadSpecOnArbitrary @[]

monadSpecOnGens :: forall (f :: * -> *) (a :: *) (b :: *) (c :: *). (Show a, Eq a, Show (f a), Show (f b), Show (f c), Eq (f a), Eq (f b), Eq (f c), Monad 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 (a -> f b) -> String -> Gen (b -> f c) -> String -> Gen (f (a -> b)) -> String -> Spec Source #

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

Example usage:

    monadSpecOnGens
        @[]
        @Int
        (pure 4)
        "four"
        (genListOf $ pure 5)
        "list of fives"
        (genListOf $ pure 6)
        "list of sixes"
        ((*) <$> genValid)
        "factorisations"
        (pure $ \a -> [a])
        "singletonisation"
        (pure $ \a -> [a])
        "singletonisation"
        (pure $ pure (+ 1))
        "increment in list"