smallcheck-laws-0.1: SmallCheck properties for standard type classes

Safe HaskellSafe
LanguageHaskell2010

Test.SmallCheck.Laws.Monad

Contents

Description

Provided a Monad is already an Applicative there is no need to check the first 2 monad laws. See Bind for which laws are exclusive for the >>= method.

Synopsis

Monad laws

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

Check the associativity law hold for the given Monad Series:

(m >>= f) >>= g ≡ m (f >=> g)

This is equivalent to:

(f >=> g) >=> h == f >=> (g >=> h)

Assuming join is the default implementation of Monad.