haskell / random

Random number library
Other
53 stars 50 forks source link

Added examples to randomIO and randomRIO #115

Closed mpscholten closed 3 years ago

mpscholten commented 3 years ago

This adds examples and improves documentation for randomIO and randomRIO :)

lehins commented 3 years ago

@mpscholten Thank you for your PR. Documentation for randomIO and randomRIO indeed needed some improvements.

Unfortunately, your suggested documentation additions do not align well with intentions of this library. First of all, both randomIO and randomRIO are historical baggage and are advised against, because global mutable state has huge downsides and unexpected consequences. Second of all there is a new stateful interface that supersedes the approach of single global mutable PRNG. Lastly we also use doctests for all our examples.

I've tried to convey all of this in a new PR #119 , which I'd appreciate any feedback on. Closing this one in favor of the aforementioned one.