Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module is intended to be imported qualified
, for example:
import qualified Test.Tasty.Lens.Traversal as Traversal
- test :: forall f s a. (Applicative f, Eq s, Eq (f s), Eq (f (f s)), Show s, Show a, Show (f a), Serial IO s, Serial Identity a, Serial IO a, Serial IO (f a), CoSerial IO a) => Proxy f -> Traversal' s a -> TestTree
- testSeries :: forall f s a. (Applicative f, Eq s, Eq (f s), Eq (f (f s)), Show s, Show a, Show (f a), Serial Identity a, Serial IO a, Serial IO (f a), CoSerial IO a) => Proxy f -> Traversal' s a -> Series IO s -> TestTree
- testExhaustive :: forall f s a. (Applicative f, Eq s, Eq (f s), Eq (f (f s)), Show s, Show a, Show (f a), Serial IO s, Serial Identity a, Serial IO a, Serial IO (f a), CoSerial IO a) => Proxy f -> Traversal' s a -> TestTree
- module Test.SmallCheck.Lens.Traversal
Tests
test :: forall f s a. (Applicative f, Eq s, Eq (f s), Eq (f (f s)), Show s, Show a, Show (f a), Serial IO s, Serial Identity a, Serial IO a, Serial IO (f a), CoSerial IO a) => Proxy f -> Traversal' s a -> TestTree Source
A Traversal'
is only legal if it is a valid Setter'
and if the
following laws hold:
t pure ≡ pure
fmap (t f) . t g ≡ getCompose . t (Compose . fmap f . g)
The Serial
and CoSerial
instances for s
and a
. If you are
not creating your own orphan instances be aware of combinatorial explosion
since the default implementations usually aim for exhaustivity.
The Proxy
arguments lets you choose the Functor
to use in the tests. f
and g
are of type a -> functor a
and when combining them the sum of
Series
is used.
This also uses Test.Tasty.Lens.Setter.
test
to validate the
Traversal'
is a valid Setter'
.
testSeries :: forall f s a. (Applicative f, Eq s, Eq (f s), Eq (f (f s)), Show s, Show a, Show (f a), Serial Identity a, Serial IO a, Serial IO (f a), CoSerial IO a) => Proxy f -> Traversal' s a -> Series IO s -> TestTree Source
A Traversal'
is only legal if it is a valid Setter'
and if the
following laws hold:
t pure ≡ pure
fmap (t f) . t g ≡ getCompose . t (Compose . fmap f . g)
Here you explicitly pass a custom Series
for s
, while for a
the
Serial
instance is used. If you want to fine tune both Series
, you
should create your own TestTree
.
The Proxy
arguments lets you choose the Functor
to use in the tests. f
and g
are of type a -> functor a
and when combining them the sum of
Series
is used.
This also uses Test.Tasty.Lens.Setter.
test
to validate the
Traversal'
is a valid Setter'
.
testExhaustive :: forall f s a. (Applicative f, Eq s, Eq (f s), Eq (f (f s)), Show s, Show a, Show (f a), Serial IO s, Serial Identity a, Serial IO a, Serial IO (f a), CoSerial IO a) => Proxy f -> Traversal' s a -> TestTree Source
A Traversal'
is only legal if it is a valid Setter'
and if the
following laws hold:
t pure ≡ pure
fmap (t f) . t g ≡ getCompose . t (Compose . fmap f . g)
This is the same as test
except it uses the product when combining the
f
and g
Series
and Test.Tasty.Lens.Setter.
testExhaustive
to validate Setter'
laws. Be aware of combinatorial explosions.