Document and test laws for standard type classes

Latest on Hackage:0.0.0

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

MIT licensed and maintained by Simon Hengel
# Reusable specifications
(similar in spirit to [checkers](http://hackage.haskell.org/package/checkers))

## Check Monoid laws

`shouldSatisfyMonoidLaws` can be used to specify, that a given type should
satisfy the Monoid laws.

~~~ {.haskell .literate}
-- file Spec.hs
import Test.Hspec
import Test.Hspec.Laws

main :: IO ()
main = hspec $ do
describe "List as a Monoid" $
shouldSatisfyMonoidLaws (undefined :: [Int])

Running this produces a nice spec.

$ runhaskell Spec.hs

List as a Monoid
- is a left identity
- is a right identity

- is associative

Finished in 0.1142 seconds
3 examples, 0 failures
Depends on:
Used by 1 package:
comments powered byDisqus