Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #396
Overview of design:
Arb.register
methodIArbMap
type which encapsulates an immutableType
->Arbitrary<'TType>
map.Property
of the formIArbMap -> Gen<...>
, in other words a "Reader" of the arbmap state. I saw no reason to also make it a "Writer" but that could be easily achieved by also returning anIArbMap
.Arb.Default
API - this unfortunately makes discovering which instances are available harder, then again you could say this was already largely the case (e.g. you could only know that union, record types, enums etc were supported by reading the docs). From a maintenance perspective this is a big advantage though, plus there is now only one way to do things.Gen
andArb
API - with Implement integrated shrinking à la Hedgehog? #403 I'm envisaging thatGen
will absorb all ofArb
, and thatGen
essentially contains only parametrizable generators (and almost all of the current primitive generators will be parametrized, increasing flexibility significantly)TypeClass
(to be renamed at some point) into a sort of parameter-based dependency injection thing. The idea is that in time this allows me to remove a whole bunch of code to put together the defaultArbitrary
(orGen
by then) instances.The
ArbMap
design here is rather final - it seems good to me and fullfills pretty much all requirements set forth in the RFC.The
Arb
API changes here are preliminary, as well as other API changes - in particular, I'm expecting thatGen
andArb
will be merged.Finally, I can see how this opens some opportunities to enhance registration functionality in the vein of #334
TODO: