[Haskell-cafe] Custom QuickCheck Gens without custom shrinks
Niklas Hambüchen
mail at nh2.me
Wed Aug 15 21:35:53 CEST 2012
I wrote this Gen to generate lines of texts without \NUL and \n:
fullLinesProp = forAll linesGen ...
linesGen = listOf . listOf $ arbitrary `suchThat` (`notElem`
['\NUL', '\n'])
-- alternatively:
linesGen = arbitrary `suchThat` (all (all (`notElem` ['\NUL', '\n'])))
However, I just realized that QuickCheck disables shrinking when I use
this instead of (linesGen = arbitrary :: Gen [String]).
Why is that? Is there a way to get what I want + shrinking without
defining a custom shrink (e.g. forAllShrink)?
Thanks
More information about the Haskell-Cafe
mailing list