A library for testing implementations of mtl classes.
test-monad-laws defines laws for monadic effects as QuickCheck properties.
To use this library, quickcheck-higherorder is also needed.
Supported classes:
mtl
: MonadExcept
, MonadReader
, MonadState
, MonadWriter
transformers
: MonadTrans
transformers-base
: MonadBase
monad-control
: MonadTransControl
, MonadBaseControl
This project also tests the effectiveness of these laws, by including some incorrect implementations, called mutants, and some invalid laws.
For every mtl class, for example MonadReader
:
Test.Monad.Reader
, defining laws for the class.
Note that these laws are not official. But if your instance does not satisfy them,
now you know.Test.Monad.Reader.Mutants
.Test.Monad.Reader.Checkers
.
It can easily be consumed by the library tasty-quickcheck.Papers with some relevant laws:
do
it: Simple Monadic Equational Reasoning. Jeremy Gibbons, Ralf Hinze.Hackage search terms: laws, properties.