Skip to content

Commit

Permalink
Add compatibility with recently added ByteArray to base:
Browse files Browse the repository at this point in the history
* Switch to using `ByteArray` for type class implementation instead of
  `ShortByteString`
* Add `unsafeUniformFillMutableByteArray` to `RandomGen` and a helper function
  `defaultUnsafeUniformFillMutableByteArray` that makes implementation
  for most instances easier.
* Add `uniformByteArray`, `uniformByteString` and `uniformFillMutableByteArray`
* Add `uniformByteArrayM` to `StatefulGen`
* Add `uniformByteStringM` and `uniformShortByteStringM`
* Deprecate `uniformShortByteString` in favor of `uniformShortByteStringM` for
  consistent naming and a future plan of removing it from `StatefulGen`
  type class
* Expose a helper function `genByteArrayST`, that can be used for
  defining implementation for `uniformByteArrayM`
  • Loading branch information
lehins committed Nov 24, 2023
1 parent 9f92421 commit 9dd6ca4
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 72 deletions.
2 changes: 2 additions & 0 deletions random.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ library
deepseq >=1.1 && <2,
mtl >=2.2 && <2.4,
splitmix >=0.1 && <0.2
if impl(ghc < 9.4)
build-depends: data-array-byte

test-suite legacy-test
type: exitcode-stdio-1.0
Expand Down
4 changes: 4 additions & 0 deletions src/System/Random.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ module System.Random
, Uniform
, UniformRange
, Finite
-- * Generators for sequences of pseudo-random bytes
, uniformByteArray
, uniformByteString
, uniformFillMutableByteArray

-- ** Standard pseudo-random number generator
, StdGen
Expand Down
Loading

0 comments on commit 9dd6ca4

Please sign in to comment.