tasty-laws-0.3: Test common laws

Safe HaskellNone
LanguageHaskell2010

Test.Tasty.Laws.Monoid

Description

This module is intended to be imported qualified:

import qualified Test.Tasty.Laws.Monoid as Monoid

Synopsis

Documentation

test :: (Eq a, Show a, Monoid a) => Series IO a -> TestTree Source

tasty TestTree for Monoid laws. Sum of series for associativity law.

(a <> a) <> a == a <> (a <> a)
(b <> b) <> b == b <> (b <> b)
(c <> c) <> c == c <> (c <> c)
...

testExhaustive :: (Eq a, Show a, Monoid a) => Series IO a -> TestTree Source

tasty TestTree for Monoid laws. Product of series for associativity law. Be aware of combinatorial explosion.

(a <> a) <> a == a <> (a <> a)
(a <> a) <> b == a <> (a <> b)
(a <> b) <> b == a <> (b <> b)
...

testMConcat :: (Eq a, Show a, Monoid a) => Series IO a -> TestTree Source

Use this test when implementing the mconcat method.