qcheck icon indicating copy to clipboard operation
qcheck copied to clipboard

Deriver: support qcheck and qcheck2

Open vch9 opened this issue 4 years ago • 4 comments

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

vch9 avatar Oct 11 '21 13:10 vch9

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

Looks like good names to me!

jmid avatar Oct 12 '21 07:10 jmid

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]

vch9 avatar Oct 12 '21 07:10 vch9

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.

c-cube avatar Oct 12 '21 13:10 c-cube

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

vch9 avatar Oct 13 '21 08:10 vch9