Closed kindaro closed 6 years ago
It's intended but not thought through very carefully.
Int8/16/32/64
and Word8/16/32/64
all generate integers from the full range of their type.
Ideally, I would like Int
and Word
to also do that. However, Int
in Haskell most often represents a small integer, such as the length of a list (or at any rate small integers are usually represented as Int
). That's why Int
has a different generator, which only generates small values.
I'm not sure that the same reasoning applies to Word
, which is why it uses the same generator as Word32/64
. However, I may be wrong, and it could also be good for predictability to let Int
and Word
have the same generator. I will leave this open for now to see if anyone else has an opinion.
So, does maxSize
have any effect on those types whose generators generate integers from their full range?
Yes - the full range is only generated when the size is at least 100 (the default maximum size for QuickCheck). Smaller sizes generate smaller integers - you can sort of see this in your output above.
Fixed by 0d547a4.
So I've been toying with prime numbers and, you see, I can't directly find out if a number such as
maxBound :: Word
is one or not. Not in a lifetime anyway. So I set up aquickCheckWith (stdArgs { maxSize = 1024 }) ...
to make sure I live to see the test results. Imagine my shock wnen it occured that theInt
s generated fall within the "safe" range butWord
figures quickly rise to the order ofmaxBound
, on which I can't expect termination in a reasonable time frame.Is this intended?
I want to underline that
Int
s fall very much within the range.I use
stack
with more or less the latest nightly snapshot.