Open rhofour opened 6 years ago
Hi, it would be nice to have even more flexibility:
listRange: Int -> Int -> Fuzzer a -> Fuzzer (List a)
listRange lo hi fuzzer =
...
It can favour shorter lists like the current Fuzz.list
.
I'm creating combinatorics library, so my use-case is:
, fuzz
(( char, intRange 0 3 )
|> tuple
|> listOfLength 3
-- listRange 0 3 would be better
)
"permutations with repetitions"
<|
\setWithCounts ->
-- setWithCounts = e.g. [("a",2), ("x",5)]
...
Thanks!
If we're going to do this, and I'm not saying we are, why not: Fuzzer Int -> Fuzzer a -> Fuzzer (List a)
?
I was thinking something like: listOfLength: Int -> Fuzzer a -> Fuzzer (List a)
This looks like it shouldn't be too hard to generalize from the existing list function. The major benefit would be to allow users to decide their own probability distribution over the generated list length (using something like Fuzz.andThen). This is what motivated me to suggest this and it would limit the severity of #168 .
This is already possible with what's provided, but it could be easier: