
Hi, I'm glad you liked LeanCheck. :-) On Mon, 10 Sep 2018 15:09:43 +0200, Johannes Waldmann wrote:
Among the enumerative testing libraries, the "competition" is between leancheck and smallcheck. For, me the important differences are
Enumeration of algebraic data types (ADTs), via built-in serial combinators, e.g., cons0 Leaf \/ cons2 Branch
* leancheck enumerate by size (number of nodes in tree) * smallcheck enumerates by depth (longest path in tree)
I (much!) prefer "by size" because this delays combinatorial explosion somewhat.
Yes, size bounded enumeration is more tractable. The combinatorial explosion is still there, but a lot of the times much later in the enumeration. LeanCheck also avoids repeating tests. SmallCheck may/will repeat tests when testing successive "depths".
Automated Listable/Serial instances for ADTs
* leancheck uses template-haskell * smallcheck uses DeriveGeneric
Here I would actually prefer DeriveGeneric.
Might I ask why the preference?
But this certainly could be added to leancheck?
Yes it could. I guess LeanCheck could provide a genericTiers / defaultTiers function (of type something like `Generic a => [[a]]`) on an optional module so that one would write: import Test.LeanCheck.Generic instance Listable MyType where tiers = genericTiers Patches or GitHub pull requests are always welcome. :-) -- I may add this myself if I ever get the time. Another addition could be defining a "default" inside the Listable typeclass itself so that one could write `data MyType = ... deriving Listable`. But I'm not very keen on this second option, as it would require an extension on LeanCheck's core which is compliant with Haskell98+Namespaces. It would also hinder the beginner-friendliness of reading that module. (Or maybe there is a way to define "orphan" default declarations for typeclasses in separate modules?)
Oh, and leancheck does not use fancy typeclassery (smallcheck needs Multiparamtypeclasses and Monads just to declare a Serial instance) and it is also easier to get at the list of counterexamples.
This was intentional, I'm a fan of simple types and interfaces. I'm glad you liked this. - Rudy