[Haskell-cafe] Generating arbitrary functions with QuickCheck?

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Wed Sep 15 20:59:39 EDT 2010


On 16 September 2010 01:58, Thomas Davie <tom.davie at gmail.com> wrote:
>> Firstly, as far as i can tell, one cannot declare a type synonym to be an instance of a type class, thus how would you make it an instance of Arbitrary?
>
> The standard solution here is to create a newtype, and generate them instead.

I've also written and used dedicated generation functions (especially
for Strings, since I don't want _really_ arbitrary strings since some
of them might accidentally bring up formatting that my parser can't
cope with (or will parse as something else).  Note that this is more
for generating sub-parts of other data types, rather than for types I
want to be able to run QC tests on.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list