[Haskell-cafe] Quick Question for QuickCheck2

Lyndon Maydwell maydwell at gmail.com
Mon Aug 30 12:06:45 EDT 2010


I'm just trying these examples, and I can't figure out how to import
quickcheck2 rather than quickcheck1. I've looked around but I can't
seem to find any information on this. How do I do it?

Thanks!

On Mon, Aug 30, 2010 at 11:56 PM, John Millikin <jmillikin at gmail.com> wrote:
> Define a custom element generator, which has characters with your
> desired values:
>
> myRange :: Gen Char
> myRange = elements (['A'..'Z'] ++ ['a' .. 'z'] ++ " ~!@#$%^&*()")
>
> You can use "forAll" to run tests with a specific generator:
>
> forAll myRange $ \c -> chr (ord c) == c
>
> On Mon, Aug 30, 2010 at 08:12, Sebastian Höhn
> <sebastian.hoehn at googlemail.com> wrote:
>> Hello,
>>
>> perhaps I am just blind or is it a difficult issue: I would like to
>> generate Char values in a given Range for QuickCheck2. There is this
>> simple example from the haskell book:
>>
>> instance Arbitrary Char where
>>   arbitrary = elements (['A'..'Z'] ++ ['a' .. 'z'] ++ " ~!@#$%^&*()")
>>
>> This does not work in QuickCheck2 since the instance is already
>> defined. How do I achieve this behaviour in QC2?
>>
>> Thanks for helping.
>>
>> Sebastian
>> _______________________________________________
>> 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
>


More information about the Haskell-Cafe mailing list