Implement Uniform and UniformRange#14
Conversation
|
This PR implements suggestion from here: #8 (comment) |
Shimuuar
left a comment
There was a problem hiding this comment.
I like changes but didn't pay much attention to changes to Random
| uniform :: MonadRandom g m => g -> m a | ||
|
|
||
| class UniformRange a where | ||
| uniformR :: MonadRandom g m => (a, a) -> g -> m a |
There was a problem hiding this comment.
Here we have question of semantics. What should uniformR (a,b) do for a > b? random's position is that it's unspecified. mwc-random made choice uniformR (a,b) = uniformR (b,a)
There was a problem hiding this comment.
I think that is a fine choice. It is definitely better than throwing an error. We could of course return a Maybe, but for consistency sake with other libraries and current randomR I think: uniformR (a,b) = uniformR (b,a) is the right way to go.
|
I am glad you like that changes, I am onboard with this as well. Merging, if any changes are necessary we can handle em in the bigger PR. It sound like a problem in #8 is solved too, so we can probably close it as well. |
…uniform-range Implement Uniform and UniformRange
No description provided.