[Haskell-cafe] ANN: LeanCheck v1.0.0 – Enumerative Property Testing

Rudy Matela rudy at matela.com.br
Mon Aug 22 10:26:08 UTC 2022


Hello Haskell Café,

A new version of LeanCheck <https://hackage.haskell.org/package/leancheck>
is out (v1.0.0 <https://hackage.haskell.org/package/leancheck>).  LeanCheck
is a property testing library (like QuickCheck) that tests values
enumeratively.

*Example.*  Here is a simple example of LeanCheck in action showing that
sorting is idempotent and list union is not commutative:

> import Test.LeanCheck
> import Data.List (sort, union)

> check $ \xs -> sort (sort xs) == sort (xs::[Int])
+++ OK, passed 200 tests.

> check $ \xs ys -> xs `union` ys == ys `union` (xs::[Int])
*** Failed! Falsifiable (after 4 tests):
[] [0,0]

LeanCheck works on all types that are instances of the Listable typeclass
and is able to derive instances automatically using either Template Haskell
or GHC.Generics. See LeanCheck’s Haddock documentation
<https://hackage.haskell.org/package/leancheck/docs/Test-LeanCheck.html>
for more details.  LeanCheck is compatible with Hspec
<https://hackage.haskell.org/package/hspec-leancheck>, Tasty
<https://hackage.haskell.org/package/tasty-leancheck> and test-framework
<https://hackage.haskell.org/package/test-framework-leancheck>.

*What's new?*  Version 1.0.0 signalizes stability in the API.  LeanCheck
has not actually changed much in the past couple of years and there are no
significant differences between the early 0.9 series.

*Installing.*  You can find LeanCheck on Hackage
<https://hackage.haskell.org/package/leancheck> or GitHub
<https://github.com/rudymatela/leancheck>.  It is also tracked on Stackage
<https://www.stackage.org/package/leancheck>.  You can install it with:

$ cabal install leancheck

– Rudy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20220822/adb016e5/attachment.html>


More information about the Haskell-Cafe mailing list