Last active
February 10, 2017 12:14
-
-
Save deque-blog/29a308f68b9b52f2bf658065ac070f5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resultTree :: (Show a, Testable t) => Shrink a -> a -> (a -> t) -> Property | |
resultTree shrinker arg prop = | |
Property $ Gen $ \rand -> | |
let shrinkTree = buildTree shrinker arg -- Build the shrink tree | |
resultTree = fmap toResult shrinkTree -- Transform it to a result tree | |
toResult x = -- To compute a result tree | |
addCounterExample x $ -- Add the outer arg to all failures | |
runProp (property (prop x)) rand -- Inside the sub result tree | |
in joinTree resultTree -- At the end, join the result tree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment