fakedata
fakedata copied to clipboard
Provide comibnators using uniform
It exists for backward compatibility, and using uniform we get a much more useful api. For example, it can automatically figure out uniform tuples and it expects the underlying monad to carry around the seed.
I ran into this issue today. Now I just worked around it by running the random function by hand twice and passing the stdgen by hand around.
Checkout the docs, they recommend using uniform as well: https://hackage.haskell.org/package/random-1.2.0/docs/System-Random.html#t:Random
Yeah, I have been wanting to move over to Uniform. I wouldn't be opposed to a PR support both the Uniform/Random variants for a short term (using CPP).
Now I just worked around it by running the random function by hand twice and passing the stdgen by hand around.
Note that you can currently use setNonDeterministic function now to get a similar behavior: https://hackage.haskell.org/package/fakedata-0.7.0/docs/Faker.html#v:setNonDeterministic
In this case it's really about the type level machinery I'm interested in, not so much the non-deterministic behavior (in fact it was already set).
Yeah, I have been wanting to move over to Uniform. I wouldn't be opposed to a PR support both the Uniform/Random variants for a short term (using CPP).
I was thinking of keeping the old functions in place but adding other ones that use Uniform instead. Allowing users to choose whatever type class they like.
After all, random isn't deprecated or anything
@jappeace I looked into this today and it seems I need to only introduce two more function: https://hackage.haskell.org/package/fakedata-0.7.0/docs/Faker-Combinators.html
I was surprised that only two functions requires the Random constraint. I'm just planning to add the suffix Uniform to those functions. What do you think ? Any other better names you have in mind ?
Adding fromRangeUnfiform and pickAnyUniform would be a great help indeed. An excellent solution!
I tried implementing this and got stuck because of dependency issues as it seems the ecosystem hasn't yet adopted to random-1.2.0 yet. I think I would wait till this issue get's closed: https://github.com/commercialhaskell/stackage/issues/5474