Future of splittable PRNG and infinite structures support
- Dominant language
- Haskell
- Stars
- 59
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
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 in `RandomGen`
* Introduction of the `SplitGen` class, which cannot be utilized in `Random` instances (with `Random` itself being discouraged)
* Recommendation to use `Uniform` and `UniformRange`, 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.