-
Notifications
You must be signed in to change notification settings - Fork 156
Ts constrained manual #4985
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
base: master
Are you sure you want to change the base?
Ts constrained manual #4985
Conversation
a04521c
to
9f2bb0c
Compare
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.
Looks good overall. The formatting of code examples is inconsistent though.
8c2b867
to
b4d4aee
Compare
This is a manual of how to use the constrained-generators libray in mark-down Tries to address every feature that is accessible from Constrained.API and a bit more.
b4d4aee
to
9bfb92b
Compare
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.
I'm only about halfway through, but I wanted to give you what I have so far. Nothing major, just a lot of little things I noticed.
Co-authored-by: Neil Mayhew <neil.mayhew@iohk.io>
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.
Some more interim comments
pure $ (w < x && x < y && y < z) ==> property (w < z) | ||
``` | ||
|
||
The problem with this is that the probability that the precedant `(w < x && x < y && y < z)` is True, for random |
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.
I'm not familiar with the word "precedant" (unless it's a typo for "precedent"). Either way, I think "condition" would be a more familiar term for programmers.
The problem with this is that the probability that the precedant `(w < x && x < y && y < z)` is True, for random | |
The problem with this is that the probability that the condition `(w < x && x < y && y < z)` is `True`, for random |
``` | ||
|
||
A vacuous pass, becomes a QuickCheck `discard`, so we cannot find 100 successful passes. | ||
We can do a better job by constraining the precedant using `genFromSpec` |
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 can do a better job by constraining the precedant using `genFromSpec` | |
We can do a better job by constraining the input using `genFromSpec` |
Now this isn't a very good test either, since the precedant is alway true. A better solution would be to | ||
generate a mix, where the precedent is True most of the time, but sometimes False. |
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.
Now this isn't a very good test either, since the precedant is alway true. A better solution would be to | |
generate a mix, where the precedent is True most of the time, but sometimes False. | |
Now this isn't a very good test either, since the condition is always true. A better solution would be to | |
generate a mix, where the condition is `True` most of the time, but sometimes `False`. |
+++ OK, passed 100 tests; 7 discarded. | ||
``` | ||
This makes it possible to write conditional 'implication' properties that have a high probability of | ||
not being vacuosly true. |
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.
not being vacuosly true. | |
not being vacuously true. |
First draft of a Manual for constrained generators.
Adds two files to docs/constrained-generators
Manual.md and ManualExamples.hs, which is a executable file with the examples used in Manual.md
CHANGELOG.md
files updated for packages with externally visible changes.NOTE: New section is never added with the code changes. (See RELEASING.md).
.cabal
andCHANGELOG.md
files when necessary, according to theversioning process.
.cabal
files updated when necessary.NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
scripts/fourmolize.sh
).scripts/cabal-format.sh
).hie.yaml
updated (usescripts/gen-hie.sh
).