Skip to content

Commit 9dd6ca4

Browse files
committed
Add compatibility with recently added ByteArray to base:
* 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`
1 parent 9f92421 commit 9dd6ca4

File tree

8 files changed

+268
-72
lines changed

8 files changed

+268
-72
lines changed

random.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ library
100100
deepseq >=1.1 && <2,
101101
mtl >=2.2 && <2.4,
102102
splitmix >=0.1 && <0.2
103+
if impl(ghc < 9.4)
104+
build-depends: data-array-byte
103105

104106
test-suite legacy-test
105107
type: exitcode-stdio-1.0

src/System/Random.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ module System.Random
2828
, Uniform
2929
, UniformRange
3030
, Finite
31+
-- * Generators for sequences of pseudo-random bytes
32+
, uniformByteArray
33+
, uniformByteString
34+
, uniformFillMutableByteArray
3135

3236
-- ** Standard pseudo-random number generator
3337
, StdGen

0 commit comments

Comments
 (0)