-
Notifications
You must be signed in to change notification settings - Fork 2
Generate shrink implementations in quickCheckTool
#87
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
Conversation
f0e9bfd to
7eb79f1
Compare
adamgundry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for not realising before now, but I don't think we necessarily need to add tools that merely derive standard classes, because datatypesTool' already makes it possible to change the derived classes alongside the datatype definition. Maybe we need to make that API more convenient/discoverable, though.
I'm in two minds about use the use of genericShrink. I can see it is easy to add, but the additional compile-time cost seems like it could well be significant for a large schema, and it shouldn't be that hard (famous last words) to generate shrinker implementations using TH.
@adamgundry yes, I'm aware of
I can try looking into that, or bail out if that proves to be too tricky; I understand that the compile-time cost for |
f45a2e5 to
ee08f85
Compare
|
@adamgundry I'm completely fried after a day intermittently staring at TH splices,but I think we are almost there, but I have ran out of steam on However, my TH-fu failed me and at the moment I'm generating something like: which wouldn't shrink properly, and I know for a fact as in the past (scrapped in the last commit) I have generated a Then, we can try in Atlas, maybe generating (locall) a silly test with a degenerate FK, and see if things shrinks fine (or, failing that, I can use my WIP traversal branch to generate a huge payload there). |
|
@adamgundry This is now ready to go -- I have cherry-picked your commit and implemented |
c08c3c3 to
655aad0
Compare
Implement: * `shrinkNewtype` to shrink `SpecNewType`; * `shrinkUnion` to shrink `SpecUnion`; * `SpecEnum` does not shrink; * `shrinkRecord` to shrink `SpecRecord`;
655aad0 to
3638d0a
Compare
bc067f9 to
a25cec9
Compare
adamgundry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're getting there! Thanks @adinapoli.
shrink default implementation via genericShrink, add genericsTool and dataTypeableToolshrink implementations in quickCheckTool
Fixes #84 by implementing
shrinkfor our existingArbitraryinstances viagenericShrink.As that requires the datatypes deriving a
Genericinstance, I have also added agenericsToolto smooth things out.I have transplanted the
dataTypeableToolthat I used in Atlas to generateDatainstances, forsyb& co.