Provide sample failed value to such-that's ex-fn for better error messages

Description

The `:ex-fn` that we can pass to `such-that` gets the argument `{`:gen` .., `red` .., `:max-tries` ..}`. It would be very helpful to include also a sample value that failed the predicate.

This is especially useful for Clojure Spec that uses

(such-that #(valid? spec %) g 100)

for custom generators defined for a particular spec. Currently we can learn that the spec for `:erson` failed to match any of the generated values - but if we had also a sample failed value available, we could run `(spec/explain-data spec <the value>)` on it and learn e.g. that the problem was that erson :address :zip had too few numbers.

So provide an additional key, something like `failed-value` or `sample-failed-value` or `first-failed-value`.

Environment

None

Status

Assignee

gfredericks

Reporter

Jakub Holý

Labels

None

Approval

None

Patch

Code

Priority

Major
Configure