Skip to content
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

Review exposed internals #253

Open
Bodigrim opened this issue Jul 9, 2020 · 2 comments
Open

Review exposed internals #253

Bodigrim opened this issue Jul 9, 2020 · 2 comments

Comments

@Bodigrim
Copy link
Contributor

Bodigrim commented Jul 9, 2020

It would be nice to review which parts of exposed internal modules proved to be useful and expose them through non-internal modules.

Also we need to discuss whether it is acceptable to carve out exposed internal from PVP guarantees (thus following suit of containers) starting from the next major release.

@andrewthad
Copy link
Contributor

I'll throw two operators out there that do not currently exist in bytestring, but I need them sometimes, and it makes me reach for the internal modules:

-- | Makes a copy if the bytearray is unpinned. Aliases if it is pinned. Takes slicing metadata.
fromByteArray# :: ByteArray# -> Int -> Int -> ByteString
-- | Always aliases the byte array. Guaranteed to be O(1). Undefined behavior if bytearray is unpinned.
fromPinnedByteArray# :: ByteArray# -> Int -> Int -> ByteString

These are both important operators for people who want to build use MutableByteArray (from primitive), runST, and writeByteArray (probably writing out Word8s) to build ByteStrings. Currently, the public API makes this impossible.

@Bodigrim
Copy link
Contributor Author

Bodigrim commented Nov 3, 2020

@andrewthad I think fromShort / toShort + slicing could fit the bill now.

@clyring clyring added this to the 0.12.0.0 milestone Jan 15, 2023
@clyring clyring removed this from the 0.12.0.0 milestone Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants