BSD-3-Clause licensed and maintained by Rudy Matela
This version can be pinned in stack with:leancheck-instances-0.0.2@sha256:69cc99cecf14e8fdf6f5701196ec55aea65c53b83f9e049d9b3ccfbf671eee01,2969

LeanCheck

leancheck-instances’s Build Status leancheck-instances on Hackage leancheck-instances on Stackage LTS leancheck-instances on Stackage Nightly

This package extends LeanCheck by providing Listable instances for common types provided by the Haskell Platform.

This package is to LeanCheck what quickcheck-instances is to QuickCheck. The current objective is to include all types supported by quickcheck-instances.

Installing

To install the latest leancheck-instances version from Hackage, just run:

$ cabal update
$ cabal install leancheck-instances

Examples

Importing the library:

> import Test.LeanCheck
> import Test.LeanCheck.Instances

Checking properties of Text:

> import qualified Data.Text as T
> check $ \t -> T.reverse (T.reverse t) == t
+++ OK, passed 200 tests.
> check $ \t -> T.reverse t == t
*** Failed! Falsifiable (after 6 tests):
"a "

Enumerating maps:

> import Data.Map
> list :: [Map Bool Bool]
[ fromList []
, fromList [(False,False)]
, fromList [(False,True)]
, fromList [(True,False)]
, fromList [(True,True)]
, fromList [(False,False),(True,False)]
, fromList [(False,False),(True,True)]
, fromList [(False,True),(True,False)]
, fromList [(False,True),(True,True)]
]
> take 7 $ list :: [Map Int Int]
[ fromList []
, fromList [(0,0)]
, fromList [(0,1)]
, fromList [(1,0)]
, fromList [(0,-1)]
, fromList [(1,1)]
, fromList [(0,0),(1,0)]
]

Further reading / see also

Changes

Changelog for leancheck-instances

v0.0.2

  • Listable Set instance;
  • Listable Map instance;
  • Listable IntSet instance;
  • Listable IntMap instance;
  • Some Data.Time instances;
  • Listable Array instance.

v0.0.1

  • ByteString instances;
  • Natural instance;
  • Text instance;
  • initial release on Hackage.