-
Notifications
You must be signed in to change notification settings - Fork 57
Description
The direction of the random
package in recent releases emphasizes using StatefulGen
instances with strict monads. This has led to several API changes:
- Deprecation of
RandomGenM
- Deprecation of the
split
function inRandomGen
- Introduction of the
SplitGen
class, which cannot be utilized inRandom
instances (withRandom
itself being discouraged) - Recommendation to use
Uniform
andUniformRange
, which are restricted to finite value generation and do not leverage splittable PRNGs
I understand that most PRNGs are not splittable, and it is sensible to optimize the API around this common scenario. The current direction makes considerable sense for these typical use cases. However, I am concerned about the diminished support for use cases involving splittable PRNGs.
My specific context: I'm developing a package that needs to generate infinite data structures lazily. Previously, this could have been neatly handled via type class instances. With the current changes, generating infinite structures requires standalone functions. Additionally, my package employs a QuickCheck-style monad for lazy generation. While it's not impossible to implement with StatefulGen
, the FrozenGen
abstraction feels significantly less elegant than the deprecated RandomGenM
in this scenario.
My impression is that these design choices were made with full awareness of the trade-offs involved. However, I haven't found issues or design documents explicitly addressing these decisions. I'm opening this issue primarily for clarity: if the current direction is fully intentional, documenting the rationale here will help others who encounter similar questions. Alternatively, if there is a broader plan to support lazy and infinite random value generation alongside monadic contexts, having that plan documented would be beneficial.