Repository navigation
Major restructure of the module: - #101
Conversation
* Separate `System.Random` into:
* `System.Random.Internal` that hold most of the classes,
internal functions and some of the instances
* `Sytstem.Random` that export the pure interface only. That means
`RandomGen`, `Random`, `Uniform` and `UniformRange` classes
* `System.Random.Monad` all of the monadic functionality plus the
re-export of the full `System.Random` module.
* Split the relevant parts of documentation into Pure and Monadic and
place them into their corresponding modules
| , uniformR | ||
| , genByteString | ||
| , Random(..) | ||
| , Uniform |
There was a problem hiding this comment.
In #96, I decided not to export Uniform and UniformRange from System.Random because their definitions use MonadRandom:
class Uniform a where
uniformM :: MonadRandom g s m => g s -> m aIn other words, in my understanding, Uniform and UniformRange as they are currently defined are part of the monadic interface, not part of the pure interface.
If a user only imports System.Random, it is not clear to me how they could use uniformM / uniformRM given that MonadRandom will not be in scope. Am I missing something here?
There was a problem hiding this comment.
There are two functions exported couple lines above uniform and uniformR. They allow usage of instances of Uniform and UniformRange type classes with pure RandomGen while hiding the fact that it is done through the MonadRandom. Which is pretty neat I think ;)
But because definitions uniformM and uniformRangeM use MonadRandom for implementation, they are not exported from System.Random, so you are partially right.
Major restructure of the module:
This is more of what I had in mind when I suggested the restructure.
System.Randominto:System.Random.Internalthat hold most of the classes,internal functions and some of the instances
Sytstem.Randomthat export the pure interface only. That meansRandomGen,Random,UniformandUniformRangeclassesSystem.Random.Monadall of the monadic functionality plus there-export of the full
System.Randommodule.place them into their corresponding modules