[Haskell-cafe] QuickCheck-like tests with GHC.Generic deriving

Dag Odenhall dag.odenhall at gmail.com
Wed Nov 20 14:37:19 UTC 2013


There’s a branch adding support for Generic deriving of Arbitrary, more
than a year old. I always wondered why it was never merged into master and
released on Hackage.


On Wed, Nov 20, 2013 at 9:02 AM, José Pedro Magalhães <jpm at cs.uu.nl> wrote:

> Hello,
>
> regular <http://hackage.haskell.org/package/regular-0.3.4> has a generic
> implementation of Arbitrary that even lets you specify size and
> give each constructor a particular frequency (see
> Generics.Regular.Functions.Arbitrary).<http://hackage.haskell.org/package/regular-extras-0.2.2/docs/Generics-Regular-Functions-Arbitrary.html>
> If you find it useful, I'm sure it can be ported to the generic-deriving<http://hackage.haskell.org/package/generic-deriving>package, so that it
> works with GHC.Generics (or maybe to some generic-deriving-extras package
> to avoid
> making generic-deriving depend on QuickCheck).
>
>
> Cheers,
> Pedro
>
>
> On Wed, Nov 20, 2013 at 6:57 AM, Alexander Solla <alex.solla at gmail.com>wrote:
>
>> I am looking for a QuickCheck-like test framework which exposes data
>> generators (like QuickCheck's Arbitrary class) with Generic defaults.
>>
>> I have seen that SmallCheck's Serial class has Generic defaults, but it
>> isn't particularly good for my purpose (I'd like to use the generator to
>> populate deeply nested data types, and SmallCheck's generator requires
>> computing a few million values before I get any interesting ones)
>>  Something "random" would be more useful for my purpose.
>>
>> I know that the plan depends on my vaguely abusing the test-case
>> generator, but I plan on doing some testing anyway, so I figured I should
>> reuse the instance.
>>
>> That said, I'd be willing to use any random value type class with
>> Generic-default instances.
>>
>> Does anybody have any suggestions?
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131120/f4cc528c/attachment.html>


More information about the Haskell-Cafe mailing list