haskell / random

Random number library
Other
53 stars 50 forks source link

Deprecate `RandomGenM` in favor of a more powerful `FrozenGen` #149

Closed lehins closed 9 months ago

lehins commented 10 months ago
Shimuuar commented 10 months ago

That's great! It provides direct correspondence between RandomGen based API and StatefulGen one. Just a few thoughtsfrom me:

  1. modifyM clashes with one from transformers state monad. modifyGen?
  2. This addition mean that one could implement thawGenInplace :: MutableGen f m -> f -> m () which replaces existing mutable generator.
lehins commented 10 months ago
  1. modifyM clashes with one from transformers state monad. modifyGen?

modifyGen sounds good to me.

  1. This addition mean that one could implement thawGenInplace :: MutableGen f m -> f -> m () which replaces existing mutable generator.

Yes, that seems like a good feature to me.

lehins commented 9 months ago

This addition mean that one could implement thawGenInplace :: MutableGen f m -> f -> m () which replaces existing mutable generator.

@Shimuuar I've added overwriteGen :: MutableGen f m -> f -> m () to make this feature explicit and allow for more efficient implementation, like in this PR: https://github.com/haskell/mwc-random/pull/89 with copy