[Haskell-cafe] Quick-check: how to generate arbitrary complex data?

martin martin.drautzburg at web.de
Sat Jul 13 10:10:39 CEST 2013


Am 07/12/2013 09:18 AM, schrieb Roman Cheplyaka:

> QuickCheck's Gen is a functor. So you can generate a list, and then
> use fmap to add a hash to it.
> 
>   instance Arbitrary HashedList where
>     arbitrary = addHashToList <$> arbitrary
> 

This requires HashedList to be a new type, right? So far my code only
used type synonyms.

Does this mean I have to convert type synonyms into types in order to
use QuickCheck?

Does this mean I have to "plan for QuickCheck" when I design my types?





More information about the Haskell-Cafe mailing list