Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active February 10, 2017 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/29a308f68b9b52f2bf658065ac070f5a to your computer and use it in GitHub Desktop.
Save deque-blog/29a308f68b9b52f2bf658065ac070f5a to your computer and use it in GitHub Desktop.
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