Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
shrinking :: (Show a) => Shrink a -> a -> (a -> Result) -> Result
shrinking shrink arg runSub =
let children = shrink arg -- Get the children of the current branch
result = findFailing children runSub -- Look for the first failure
in case result of
Nothing -> Success
Just (shrunk, failure) -> -- In case a failure is found
shrinking shrink shrunk runSub -- Try to shrink further the child
<> -- OR (in case it fails)
addToCounterExample shrunk failure -- Add child to the counter example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment