[Haskell-cafe] Quick-check: how to generate arbitrary complex data?
martin.drautzburg at web.de
Fri Jul 12 08:33:54 CEST 2013
I have a type ("Mail") which consists of hash and a list, where the hash
keeps some redundant data of the list for faster access. I can add and
remove elements to values of this type using custom functions, called
push and pop.
Now I wanted to write some quick checks, but I have no clue how to
generate arbitrary values of this type. It will certainly no suffice to
write arbitrary instances for the underlying types (Int and Char),
because the hash and the list need to be synchronized.
Currently "Mail" it is only a type synonym. I suppose as a prerequisite
I need to wrap it into a type constructor. But then what?
More information about the Haskell-Cafe