Skip to content

Commit

Permalink
Add reference to a recent FrozenGen PR #149 in the changelog
Browse files Browse the repository at this point in the history
Also fixup example with `FrozenGen` instance in haddock
  • Loading branch information
lehins committed Nov 26, 2023
1 parent 9f92421 commit 411c7e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 7 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# 1.3.0

* Move `thawGen` from `FreezeGen` into the new `ThawGen` type class. Fixes an issue with
an unlawful instance of `StateGen` for `FreezeGen`.
* Add `modifyGen` and `overwriteGen` to the `FrozenGen` type class
* Add `splitGen` and `splitMutableGen`
* Switch `randomM` and `randomRM` to use `FrozenGen` instead of `RandomGenM`
* Deprecate `RandomGenM` in favor of a more powerful `FrozenGen`
* Improve `FrozenGen` interface: [#149](https://github.com/haskell/random/pull/149)
* Move `thawGen` from `FreezeGen` into the new `ThawGen` type class. Fixes an issue with
an unlawful instance of `StateGen` for `FreezeGen`.
* Add `modifyGen` and `overwriteGen` to the `FrozenGen` type class
* Add `splitGen` and `splitMutableGen`
* Switch `randomM` and `randomRM` to use `FrozenGen` instead of `RandomGenM`
* Deprecate `RandomGenM` in favor of a more powerful `FrozenGen`
* Add `isInRange` to `UniformRange`: [#78](https://github.com/haskell/random/pull/78)
* Add default implementation for `uniformRM` using `Generics`:
[#92](https://github.com/haskell/random/pull/92)
Expand Down
8 changes: 7 additions & 1 deletion src/System/Random/Stateful.hs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,9 @@ applyTGen f (TGenM tvar) = do
-- Here is an example instance for the monadic pseudo-random number generator
-- from the @mwc-random@ package:
--
-- > import qualified System.Random.MWC as MWC
-- > import qualified Data.Vector.Generic as G
--
-- > instance (s ~ PrimState m, PrimMonad m) => StatefulGen (MWC.Gen s) m where
-- > uniformWord8 = MWC.uniform
-- > uniformWord16 = MWC.uniform
Expand All @@ -804,8 +807,11 @@ applyTGen f (TGenM tvar) = do
--
-- > instance PrimMonad m => FrozenGen MWC.Seed m where
-- > type MutableGen MWC.Seed m = MWC.Gen (PrimState m)
-- > thawGen = MWC.restore
-- > freezeGen = MWC.save
-- > overwriteGen (Gen mv) (Seed v) = G.copy mv v
--
-- > instance PrimMonad m => ThawedGen MWC.Seed m where
-- > thawGen = MWC.restore
--
-- === @FrozenGen@
--
Expand Down

0 comments on commit 411c7e1

Please sign in to comment.