Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active February 10, 2017 14:56
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/26f7bf7b9322745acb08f6e8a204e289 to your computer and use it in GitHub Desktop.
Save deque-blog/26f7bf7b9322745acb08f6e8a204e289 to your computer and use it in GitHub Desktop.
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