A way to dynamically replace specific Possibility
with a noop without having to completely reevaluate the entire chain of Possibility
#33
Seelengrab
started this conversation in
Design & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This was brought up by @tecosaur. The general idea is that it's sometimes useful in manual exploration to temporarily "remove" a part of the statespace, so that certain generation can be more targeted towards specific errors.
I suggested the following:
This is kind of similar to
Data.Just
, except that thejust
part only happens whenreplacement
is actually set. One caveat with this approach is that it's kind of bad to change what aPossibility
can produce mid-generation, so if possible I'd like to prevent that. In particular, it's an issue if one run happens to setreplacement
, which causes the test to pass. Supposition doesn't really have knowledge about this being set, so it can't unset it to get its proper shrinks back. Could be enough to sternly warn people not to do this, and/or could there be some way to detect this being set inside a@check
? Alternatively, enforce that there is always a valid replacement present, and make the shrinker aware of having a choice which it uses (preferringinner
if allowed).That would look like so:
Which should allow the shrinker to choose which element to produce, shrinking towards the replacement.
Beta Was this translation helpful? Give feedback.
All reactions