-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ByteArray generation #153
Conversation
@Bodigrim Let me know what you think about this PR if and when you have some time. |
@lehins overall looks great! Could you possibly organise code mentioning |
2fba77c
to
66f0f10
Compare
c7eb9bd
to
bc58313
Compare
b8c0ae4
to
324069a
Compare
53909ce
to
9dd6ca4
Compare
@Bodigrim I am not sure I understand in which way you'd like it to be organized. All of the ByteArray/ShortByteString/ByteString functionality is together in the same part of the module. It probably doesn't look like that in the diff, because some of the |
c3e6fd6
to
380e221
Compare
Also fixup example with `FrozenGen` instance in haddock
8a7d6a9
to
cc7a818
Compare
* 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`
cc7a818
to
8267ce8
Compare
Fixes #142 and more.
Add compatibility with recently added
ByteArray
to base and fallback ontodata-array-byte
package for older ghc versions.Besides this we also:
MutableByteArray
, instead of creating an immutableByteArray
. This can help avoid allocations in some situations when array has already been preallocated.ByteArray
s.