Skip to content

Conversation

@jmid
Copy link
Collaborator

@jmid jmid commented Dec 10, 2025

In trying to close up the renaming adventure, I've gone over the "generator returning" shrink combinators.

Here's a status:

Combinator name QCheck.Gen QCheck.arbitrary QCheck2.Gen
add_shrink_invariant - ('a -> bool) -> 'a arbitrary -> 'a arbitrary ('a -> bool) -> 'a t -> 'a t
set_shrink - 'a Shrink.t -> 'a arbitrary -> 'a arbitrary ('a -> 'a Seq.t) -> 'a t -> 'a t
no_shrink - - 'a t -> 'a t

Observations:

  • QCheck.Gen has no shrinking, so these make little sense there
  • the set_shrink signature is slightly different, but so is classical shrinking in QCheck vs. integrated shrinking in QCheck2
  • no_shrink could be easily added to QCheck.arbitrary for consistency

This PR thus does the latter as it is a small convenience function.
While wanting to write a test for it, I was pleased to notice that we already had one 🎉 so I updated that one instead.
The update also documents that no_shrink is easier to write than set_shrink Shrink.nil... 🙂

@jmid jmid merged commit 596785e into c-cube:main Dec 11, 2025
24 checks passed
@jmid jmid deleted the add-noshrink branch December 11, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant