-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 a
In 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.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 meansRandomGen
,Random
,Uniform
andUniformRange
classesSystem.Random.Monad
all of the monadic functionality plus there-export of the full
System.Random
module.place them into their corresponding modules