[WIP] Json.Bidirectional.Fuzzable #3
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.
This branch has a new module,
Json.Bidirectional.Fuzzable, which is an altered version ofJson.Bidirectionalthat builds upFuzzervalues from elm-test'sFuzzmodule along with theEncoderandDecoder. This lets you fuzz values for aCoderwithout having to define theFuzzeryourself. SeeFuzzableTests.elmto see what this is like in practice – it's very similar toTests.elm, but the fuzzers are provided automatically by the Coders.The thing is: I'm not sure the best way to offer this functionality. Using these fuzzable Coders in production code means including the
Fuzzmodule and its dependencies in your production build. If you don't want that, then you could stick to theJson.Bidirectionalmodule and not add anything extra to your production build – but having this newFuzz-dependent module in the same package means thatelm-test 4.x.xwould become a transitive dependency of every app that useselm-json-bidirectional.I've been trying to figure out a way of having an "extensible" version of
Json.Bidirectionalthat could somehow allow you to extend it withFuzzer-building capability "after the fact", without having a dependency on theFuzzmodule itself. I have some ideas, but nothing that would provide comparable ergonomics to what's there right now.My current thinking is to release a completely different package (
elm-json-bidirectional-fuzzable?) in order to keepelm-json-bidirectionalfree of theelm-testdependency. But I welcome any suggestions!