Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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