You can create a wrapper with a newtype and then define an instance for that.

newtype Char2 = Char2 Char

instance Arbitrary Char2 where
  arbitrary = ...

You'll have to do some wrapping and unwrapping when calling your
properties to get/set the underlying Char, but this is probably the
easiest way to 'constrain' the possible arbitrary results when the
default instance for Char can be "too much."

On Mon, Aug 30, 2010 at 10:12 AM, Sebastian Höhn
<[email protected]> 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
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
- Austin
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to