File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 11# 1.3.0
22
3- * Move ` thawGen ` from ` FreezeGen ` into the new ` ThawGen ` type class. Fixes an issue with
4- an unlawful instance of ` StateGen ` for ` FreezeGen ` .
5- * Add ` modifyGen ` and ` overwriteGen ` to the ` FrozenGen ` type class
6- * Add ` splitGen ` and ` splitMutableGen `
7- * Switch ` randomM ` and ` randomRM ` to use ` FrozenGen ` instead of ` RandomGenM `
8- * Deprecate ` RandomGenM ` in favor of a more powerful ` FrozenGen `
3+ * Improve ` FrozenGen ` interface: [ #149 ] ( https://github.com/haskell/random/pull/149 )
4+ * Move ` thawGen ` from ` FreezeGen ` into the new ` ThawGen ` type class. Fixes an issue with
5+ an unlawful instance of ` StateGen ` for ` FreezeGen ` .
6+ * Add ` modifyGen ` and ` overwriteGen ` to the ` FrozenGen ` type class
7+ * Add ` splitGen ` and ` splitMutableGen `
8+ * Switch ` randomM ` and ` randomRM ` to use ` FrozenGen ` instead of ` RandomGenM `
9+ * Deprecate ` RandomGenM ` in favor of a more powerful ` FrozenGen `
910* Add ` isInRange ` to ` UniformRange ` : [ #78 ] ( https://github.com/haskell/random/pull/78 )
1011* Add default implementation for ` uniformRM ` using ` Generics ` :
1112 [ #92 ] ( https://github.com/haskell/random/pull/92 )
Original file line number Diff line number Diff line change @@ -795,6 +795,9 @@ applyTGen f (TGenM tvar) = do
795795-- Here is an example instance for the monadic pseudo-random number generator
796796-- from the @mwc-random@ package:
797797--
798+ -- > import qualified System.Random.MWC as MWC
799+ -- > import qualified Data.Vector.Generic as G
800+ --
798801-- > instance (s ~ PrimState m, PrimMonad m) => StatefulGen (MWC.Gen s) m where
799802-- > uniformWord8 = MWC.uniform
800803-- > uniformWord16 = MWC.uniform
@@ -804,8 +807,11 @@ applyTGen f (TGenM tvar) = do
804807--
805808-- > instance PrimMonad m => FrozenGen MWC.Seed m where
806809-- > type MutableGen MWC.Seed m = MWC.Gen (PrimState m)
807- -- > thawGen = MWC.restore
808810-- > freezeGen = MWC.save
811+ -- > overwriteGen (Gen mv) (Seed v) = G.copy mv v
812+ --
813+ -- > instance PrimMonad m => ThawedGen MWC.Seed m where
814+ -- > thawGen = MWC.restore
809815--
810816-- === @FrozenGen@
811817--
You can’t perform that action at this time.
0 commit comments