-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add note about enumBounded #202
Conversation
'enumBounded' is partial in many cases.
Maybe we can do a check and give an |
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 think we need both―a note in the comments, so it shows up in the docs, and also a check with an error message (in the error message we can put that same stuff as in the notes).
Should be OK to merge this as-is and have the check on a different PR, if that's easier. |
Hmm, perhaps we should mention what the docs say for
|
I'm not sure the |
Because it's diff --git a/hedgehog/test/Test/Hedgehog/Text.hs b/hedgehog/test/Test/Hedgehog/Text.hs
index 0a11e91..a320100 100644
--- a/hedgehog/test/Test/Hedgehog/Text.hs
+++ b/hedgehog/test/Test/Hedgehog/Text.hs
@@ -29,7 +29,7 @@ genOdd =
genSeed :: Gen Seed
genSeed =
- Seed <$> Gen.word64 Range.constantBounded <*> fmap fromIntegral genOdd
+ Seed <$> Gen.enumBounded <*> fmap fromIntegral genOdd
genPrecedence :: Gen Int
genPrecedence =
But yeah you're probably right that we might not need to get into such detail. |
Will mess around and try to produce a better error. Happy to kill the documentation if y'all prefer. I hadn't quite joined the dots that this had to be going via |
I think the error would be good, but no reason to hold up this comment. |
'enumBounded' is partial in some cases. Usually you actually want something like
Gen.linear minBound maxBound
or similar. The error message is pretty inscrutable when you mess it up (no source locations), so I think a cautionary message is worthwhile.Bikeshed on wording welcome