Copyright | 2018 Automattic Inc. |
---|---|
License | GPL-3 |
Maintainer | Nathan Bloomfield (nbloomf@gmail.com) |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- testReaderMonadLaws :: (Monad m, Eq r, Eq a, Eq b, Show t, Show a, Show (m a), Arbitrary t, Arbitrary r, Arbitrary a, Arbitrary (m a), Arbitrary (m b), CoArbitrary r, CoArbitrary a, Typeable m, Typeable r, Typeable a) => Proxy m -> Proxy t -> Proxy r -> Proxy a -> Proxy b -> (forall u. Eq u => t -> m u -> m u -> Bool) -> m r -> (forall u. (r -> r) -> m u -> m u) -> TestTree
- testReaderMonadLawLocalAsk :: (Monad m, Eq r, Show t, Arbitrary t, Arbitrary r, CoArbitrary r) => Proxy m -> Proxy t -> Proxy r -> (forall u. Eq u => t -> m u -> m u -> Bool) -> m r -> (forall u. (r -> r) -> m u -> m u) -> TestTree
- testReaderMonadLawLocalLocal :: (Monad m, Eq a, Show t, Show (m a), Arbitrary t, Arbitrary r, Arbitrary (m a), CoArbitrary r) => Proxy m -> Proxy t -> Proxy r -> Proxy a -> (forall u. Eq u => t -> m u -> m u -> Bool) -> (forall u. (r -> r) -> m u -> m u) -> TestTree
- testReaderMonadLawLocalThenAsk :: (Monad m, Eq r, Show t, Show (m a), Arbitrary t, Arbitrary r, Arbitrary (m a), CoArbitrary r) => Proxy m -> Proxy t -> Proxy r -> Proxy a -> (forall u. Eq u => t -> m u -> m u -> Bool) -> m r -> (forall u. (r -> r) -> m u -> m u) -> TestTree
- testReaderMonadLawLocalReturn :: (Monad m, Eq a, Show t, Show a, Arbitrary t, Arbitrary r, Arbitrary a, CoArbitrary r) => Proxy m -> Proxy t -> Proxy r -> Proxy a -> (forall u. Eq u => t -> m u -> m u -> Bool) -> (forall u. (r -> r) -> m u -> m u) -> TestTree
- testReaderMonadLawLocalBind :: (Monad m, Eq b, Show t, Show a, Show (m a), Arbitrary t, Arbitrary r, Arbitrary a, Arbitrary (m a), Arbitrary (m b), CoArbitrary r, CoArbitrary a) => Proxy m -> Proxy t -> Proxy r -> Proxy a -> Proxy b -> (forall u. Eq u => t -> m u -> m u -> Bool) -> (forall u. (r -> r) -> m u -> m u) -> TestTree
Documentation
:: (Monad m, Eq r, Eq a, Eq b, Show t, Show a, Show (m a), Arbitrary t, Arbitrary r, Arbitrary a, Arbitrary (m a), Arbitrary (m b), CoArbitrary r, CoArbitrary a, Typeable m, Typeable r, Typeable a) | |
=> Proxy m | Type constructor under test |
-> Proxy t | Equality context for |
-> Proxy r | Reader type |
-> Proxy a | Value type |
-> Proxy b | Value type |
-> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
-> m r | ask |
-> (forall u. (r -> r) -> m u -> m u) | local |
-> TestTree |
Constructs a TestTree
checking that the reader monad laws hold for m
with reader type r
and 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.
Reader Monad Laws
testReaderMonadLawLocalAsk Source #
:: (Monad m, Eq r, Show t, Arbitrary t, Arbitrary r, CoArbitrary r) | |
=> Proxy m | Type constructor under test |
-> Proxy t | Equality context for |
-> Proxy r | Reader type |
-> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
-> m r | ask |
-> (forall u. (r -> r) -> m u -> m u) | local |
-> TestTree |
local u ask === fmap u ask
testReaderMonadLawLocalLocal Source #
:: (Monad m, Eq a, Show t, Show (m a), Arbitrary t, Arbitrary r, Arbitrary (m a), CoArbitrary r) | |
=> Proxy m | Type constructor under test |
-> Proxy t | Equality context for |
-> Proxy r | Reader type |
-> Proxy a | Value type |
-> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
-> (forall u. (r -> r) -> m u -> m u) | local |
-> TestTree |
local u (local v x) === local (u . v) x
testReaderMonadLawLocalThenAsk Source #
:: (Monad m, Eq r, Show t, Show (m a), Arbitrary t, Arbitrary r, Arbitrary (m a), CoArbitrary r) | |
=> Proxy m | Type constructor under test |
-> Proxy t | Equality context for |
-> Proxy r | Reader type |
-> Proxy a | Value type |
-> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
-> m r | ask |
-> (forall u. (r -> r) -> m u -> m u) | local |
-> TestTree |
local u ask === fmap u ask
testReaderMonadLawLocalReturn Source #
:: (Monad m, Eq a, Show t, Show a, Arbitrary t, Arbitrary r, Arbitrary a, CoArbitrary r) | |
=> Proxy m | Type constructor under test |
-> Proxy t | Equality context for |
-> Proxy r | Reader type |
-> Proxy a | Value type |
-> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
-> (forall u. (r -> r) -> m u -> m u) | local |
-> TestTree |
local u (return a) === return a
testReaderMonadLawLocalBind Source #
:: (Monad m, Eq b, Show t, Show a, Show (m a), Arbitrary t, Arbitrary r, Arbitrary a, Arbitrary (m a), Arbitrary (m b), CoArbitrary r, CoArbitrary a) | |
=> Proxy m | Type constructor under test |
-> Proxy t | Equality context for |
-> Proxy r | Reader type |
-> Proxy a | Value type |
-> Proxy b | Value type |
-> (forall u. Eq u => t -> m u -> m u -> Bool) | Equality test |
-> (forall u. (r -> r) -> m u -> m u) | local |
-> TestTree |
local u (x >>= f) === local u x >>= (local u . f)