| Copyright | 2019 Automattic Inc. |
|---|---|
| License | BSD3 |
| Maintainer | Nathan Bloomfield (nbloomf@gmail.com) |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.Tasty.QuickCheck.Laws.IdentityMonad
Contents
Description
Synopsis
- testIdentityMonadLaws :: (Monad m, Eq a, Eq b, Show t, Show a, Show (m a), Arbitrary t, Arbitrary a, CoArbitrary a, Arbitrary (m a), Arbitrary (m b), Typeable m, Typeable a) => Proxy m -> Proxy t -> Proxy a -> Proxy b -> (forall u. Eq u => t -> m u -> m u -> Bool) -> (forall a. m a -> a) -> TestTree
- testIdentityMonadLawUnwrapReturn :: (Monad m, Eq a, Show a, Show t, Arbitrary t, Arbitrary a, Show (m a)) => Proxy m -> Proxy t -> Proxy a -> (forall a. m a -> a) -> TestTree
- testIdentityMonadLawReturnUnwrap :: (Monad m, Eq a, Show t, Arbitrary t, Arbitrary (m a), Show (m a)) => Proxy m -> Proxy t -> Proxy a -> (forall u. Eq u => t -> m u -> m u -> Bool) -> (forall a. m a -> a) -> TestTree
- testIdentityMonadLawBind :: (Monad m, Eq b, Show t, CoArbitrary a, Arbitrary (m b), Arbitrary t, Arbitrary (m a), Show (m a)) => Proxy m -> Proxy t -> Proxy a -> Proxy b -> (forall u. Eq u => t -> m u -> m u -> Bool) -> (forall a. m a -> a) -> TestTree
Documentation
testIdentityMonadLaws Source #
Arguments
| :: (Monad m, Eq a, Eq b, Show t, Show a, Show (m a), Arbitrary t, Arbitrary a, CoArbitrary a, Arbitrary (m a), Arbitrary (m b), Typeable m, Typeable a) | |
| => Proxy m | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> Proxy b | Value type |
| -> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
| -> (forall a. m a -> a) | unwrap |
| -> TestTree |
Constructs a TestTree checking that the identity monad laws hold for m with value types a and b, using a given equality test for values of type forall u. m u. The equality context type t is for constructors m from which we can only extract a value within a context, such as reader-like constructors.
Identity Monad Laws
testIdentityMonadLawUnwrapReturn Source #
Arguments
| :: (Monad m, Eq a, Show a, Show t, Arbitrary t, Arbitrary a, Show (m a)) | |
| => Proxy m | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> (forall a. m a -> a) | unwrap |
| -> TestTree |
unwrap . return === id
testIdentityMonadLawReturnUnwrap Source #
Arguments
| :: (Monad m, Eq a, Show t, Arbitrary t, Arbitrary (m a), Show (m a)) | |
| => Proxy m | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
| -> (forall a. m a -> a) | unwrap |
| -> TestTree |
unwrap . return === id
testIdentityMonadLawBind Source #
Arguments
| :: (Monad m, Eq b, Show t, CoArbitrary a, Arbitrary (m b), Arbitrary t, Arbitrary (m a), Show (m a)) | |
| => Proxy m | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> Proxy b | Value type |
| -> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
| -> (forall a. m a -> a) | unwrap |
| -> TestTree |
unwrap (x >>= f) === unwrap (f (unwrap x))