leancheck-instances: Common LeanCheck instances

[ bsd3, library, testing ] [ Propose Tags ]

Listable instances for types provided by the Haskell Platform.

The current objective is to include all types supported by quickcheck-instances: https://hackage.haskell.org/package/quickcheck-instances


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5
Change log changelog.md
Dependencies array, base (>=4 && <5), bytestring, containers, leancheck (>=0.7.7), nats, text, time [details]
License BSD-3-Clause
Author Rudy Matela <rudy@matela.com.br>
Maintainer Rudy Matela <rudy@matela.com.br>
Category Testing
Home page https://github.com/rudymatela/leancheck-instances#readme
Source repo head: git clone https://github.com/rudymatela/leancheck-instances
this: git clone https://github.com/rudymatela/leancheck-instances(tag v0.0.2)
Uploaded by rudymatela at 2019-01-17T02:04:26Z
Distributions LTSHaskell:0.0.5, NixOS:0.0.5, Stackage:0.0.5
Downloads 2159 total (23 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for leancheck-instances-0.0.2

[back to package description]

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