Repository navigation
Remove references to PrimGen, MutGen - #83
Conversation
|
Ready for review. |
| -- | The standard pseudo-random number generator. Uses the SplitMix | ||
| -- implementation provided by the | ||
| -- [splitmix](https://hackage.haskell.org/package/splitmix) package. | ||
| newtype StdGen = StdGen { unStdGen :: SM.SMGen } |
There was a problem hiding this comment.
Is there a reason why we are hiding the access to SMGen? I understand desire to wrap it with a newtype, but making it private is too restrictive
There was a problem hiding this comment.
My thinking was that this allows for forward-compatibility. As per our reproducibility guarantee, changing the underlying PRNG would require a major version bump. But this way we can change the underlying PRNG without also breaking the API.
What would be the advantages of making StdGen's public, e.g. via type StdGen = SMGen?
There was a problem hiding this comment.
I think changing the algorithm would be a breaking change too regardless, because properties of numbers being generated purely would change. Also same Int seed would result in different values being generated.
If someone wants to use SMGen directly they would be able to do so:
What would be the advantages of making StdGen's public, e.g. via type StdGen = SMGen?
My point is, it is not always good to completely hide the implementation from the user. I am thinking maybe we can introduce an Internal module, where all of the internal stuff can be exported from?
There was a problem hiding this comment.
we can introduce an Internal module, where all of the internal stuff can be exported from?
That sounds like a good idea to me. This should happen in a separate PR though. I've reverted the change to StdGen for now.
There was a problem hiding this comment.
Cool. If wrapping with the newtype is the way to go, then we are also missing an instance RandomGen SM.SMGen
There was a problem hiding this comment.
Oh and then instance for StdGen can be derived with GeneralizedNewtypeDeriving
|
TODO for a follow-up PR:
Edit: some of these have been addressed in #96. |
This reverts commit a645555.
|
All comments addressed and rebased. PTAL. |
Remove references to PrimGen, MutGen
Preview
Previous preview here for comparison.
... and cover
AtomicGen,IOGenandSTGeninstead.