Skip to content

Commit 411c7e1

Browse files
committed
Add reference to a recent FrozenGen PR #149 in the changelog
Also fixup example with `FrozenGen` instance in haddock
1 parent 9f92421 commit 411c7e1

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
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)

src/System/Random/Stateful.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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
--

0 commit comments

Comments
 (0)