smallcheck-laws-0.3: SmallCheck properties for common laws

Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.SmallCheck.Laws.Functor

Contents

Synopsis

Functor laws

identity :: (Eq (f a), Monad m, Show (f a), Functor f) => Series m (f a) -> Property m Source

Check the identity law hold for the given Functor Series:

fmap idid

composition :: (Monad m, Functor f, Show a, Show b, Show c, Show (f a), Eq (f c), Serial Identity a, Serial Identity b) => Series m (f a) -> Series m (b -> c) -> Series m (a -> b) -> Property m Source

Check the composition law hold for the given Functor Series:

fmap (f . g) ≡ fmap f . fmap g

Exhaustive generation for the f and g Series. Be aware of combinatorial explosion.

compositionSum :: (Monad m, Functor f, Show a, Show b, Show c, Show (f a), Eq (f c), Serial Identity a, Serial Identity b) => Series m (f a) -> Series m (b -> c) -> Series m (a -> b) -> Property m Source

Check the composition law hold for the given Functor Series:

fmap (f . g) ≡ fmap f . fmap g

This uses zipLogic for the generation of the f and g Series.