Closed lehins closed 9 months ago
That's great! It provides direct correspondence between RandomGen
based API and StatefulGen
one. Just a few thoughtsfrom me:
modifyM
clashes with one from transformers
state monad. modifyGen
?thawGenInplace :: MutableGen f m -> f -> m ()
which replaces existing mutable generator.
- modifyM clashes with one from transformers state monad. modifyGen?
modifyGen
sounds good to me.
- 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.
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
modifyGen
totally removes the need forRandomGenM
, because every frozen generator that is anetwtype
wrapper aroundRandomGen
also derives an instance forRandomGen
splitMutableGen
andsplitGen
ThawedGen
and movethawGen
into that type class to combat current unlawfulFrozenGen
instance forStateGen