Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deriver: support qcheck and qcheck2 #190

Closed
Tracked by #192
vch9 opened this issue Oct 11, 2021 · 4 comments · Fixed by #209
Closed
Tracked by #192

Deriver: support qcheck and qcheck2 #190

vch9 opened this issue Oct 11, 2021 · 4 comments · Fixed by #209

Comments

@vch9
Copy link
Contributor

vch9 commented Oct 11, 2021

The deriver should create QCheck and QCheck2 generators.
The choice could be given in the deriver's plugin name: [@@deriving qcheck] and [@@deriving qcheck2].

This was referenced Oct 11, 2021
@jmid
Copy link
Collaborator

jmid commented Oct 12, 2021

[@@deriving qcheck] and [@@deriving qcheck2].

Looks like good names to me!

@vch9
Copy link
Contributor Author

vch9 commented Oct 12, 2021

I think qcheck and qcheck2 are fine when we only derive one thing. When #191 is done, what would the plugin qcheck derives?
We could have the library version as a prefix: [@@deriving qcheck.gen] and [@@deriving qcheck.shrinker]

@c-cube
Copy link
Owner

c-cube commented Oct 12, 2021

Would it make sense for [@@deriving qcheck] to also produce an arbitrary object in addition to gen + shrinker? The suffix versions would be used to derive only specific components.

@vch9
Copy link
Contributor Author

vch9 commented Oct 13, 2021

Would it make sense for [@@deriving qcheck] to also produce an arbitrary object in addition to gen + shrinker?

Well, yes we can. However, there are two solutions:

  • Derive generator and call QCheck.make on them
    -> PROS: this is really easy to implement
    -> CONS: arbitrary fields will be missing (e.g. printer)
  • Specific derivation for arbitrary
    -> PROS: use built-in arbitrary (i.e. with printer, shrinkers etc).
    -> CONS: needs time

The suffix versions would be used to derive only specific components.

Oh yes

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 a pull request may close this issue.

3 participants