byteslice
Slicing managed and unmanaged memory
https://github.com/byteverse/byteslice
| LTS Haskell 24.33: | 0.2.15.0 |
| Stackage Nightly 2026-03-13: | 0.2.15.0 |
| Latest on Hackage: | 0.2.15.0 |
BSD-3-Clause licensed by Andrew Martin
Maintained by [email protected]
This version can be pinned in stack with:
byteslice-0.2.15.0@sha256:468a74ea985d0a6e904ca5e0e3e08f780df7ff679aa62e276e11c990ff4f1cb7,3153Module documentation for 0.2.15.0
- Data
- Data.Bytes
- Data.Bytes.Chunks
- Data.Bytes.Encode
- Data.Bytes.Encode.BigEndian
- Data.Bytes.Encode.LittleEndian
- Data.Bytes.Indexed
- Data.Bytes.Internal
- Data.Bytes.Mutable
- Data.Bytes.Text
- Data.Bytes.Text.Ascii
- Data.Bytes.Text.AsciiExt
- Data.Bytes.Text.Latin1
- Data.Bytes.Text.Utf8
- Data.Bytes.Text.Windows1252
- Data.Bytes.Types
- Data.Bytes
Depends on 11 packages(full list with versions):
Used by 4 packages in nightly-2026-03-13(full list with versions):
byteslice
Purpose
Types for dealing with slices of ‘ByteArray’ and ‘MutableByteArray’. These are never supposed to introduce overhead. Rather, they exist to clarify intent in type signatures.
receive ::
Resource -- ^ Some scarce resource
-> MutableByteArray RealWorld -- ^ Buffer
-> Int -- ^ Offset
-> Int -- ^ Length
-> IO ()
With this library, we instead write
receive ::
Resource -- ^ Some scarce resource
-> MutableBytes RealWorld -- ^ Buffer
-> IO ()
The combination of the worker-wrapper transformation and inlining means that we can expect these two to end up generating the same code in most situations.
Changes
Revision history for byteslice
0.2.15.0 – 2024-06-12
- Add functions for recovering length from
ByteArrayN - Add
Data.Bytes.Indexedfor functions onByteArrayN
0.2.14.0 – 2024-02-26
- Add functions to
Data.Bytes.Text.AsciiExt:split(1|2|3|4),splitTetragram1,anyEq,takeWhileNotEq,dropWhileNotEq,takeWhileEndNotEq, dropWhileEndEq`. - Increment upper bound on
primitive-unlifted
0.2.13.2 – 2024-02-06
- Restore
Data.Bytes.Text.Utf8.toText.
0.2.13.1 – 2024-02-01
- Update package metadata.
0.2.13.0 – 2024-01-12
- Add
replicateandreplicateBytetoData.Bytes.Chunks.
0.2.12.0 – 2023-12-14
- Add
Data.Bytes.Chunks.cons. - Add
Data.Bytes.fromLazyByteString. - Allow building with GHC 9.8.
0.2.11.1 – 2023-07-26
- Fix regression causing build failure in GHC 9.2.
0.2.11.0 – 2023-07-25
- Add
Data.Bytes.Encode.LittleEndian. - Add
splitTetragram1.
0.2.10.0 – 2023-05-01
- Add
equals13,equals14,equals15. - Add
Showinstances forBytesNandByteArrayN. - Add
equalsCStringCaseInsensitivefor ascii text.
0.2.9.0 – 2022-12-08
- Add
toShortText,toShortTextU, andtoTexttoData.Byte.Text.Ascii. - Add
fromShortTextandfromTexttoData.Bytes.Text.Utf8.
0.2.8.0 – 2022-11-21
- Add
Data.Bytes.replaceandData.Bytes.findIndices - Add
Data.Bytes.fromShortText - Add
Data.Bytes.fromPrimArray - Add
decodeDecWord - Add
concatArrayandconcatArrayU.
0.2.7.0 – 2022-02-16
- Add support for GHC 9.2.
- Drop support for GHC 8.8 and earlier.
- Add
foldlMandfoldrMfor mondic folds over byte sequences.
0.2.6.0 – 2021-09-15
- Add
BytesNandByteArrayN. - Add
isInfixOf. - Add
hForLines_andhFoldLines. - Add
liftandunliftfor converting betweenBytesandBytes#. - Move text-oriented functions from Data.Bytes to
Data.Bytes.Text.*. Provide aliases with older names that come with deprecation warning.
0.2.5.2 – 2021-02-23
- Correct compatibility shims.
0.2.5.1 – 2021-02-22 (deprecated)
- Compatibility with GHC 9.0.
0.2.5.0 – 2021-01-22
- Add
Data.Bytes.Chunks.concatByteString. - Expose
pinnedToByteStringto end users.
0.2.4.0 – 2020-10-15
- Add
toByteStringandfromByteString. - Add
fromShortByteString. - Add
equalsLatin(9|10|11|12). - Add
toPinnedByteArray,toPinnedByteArrayClone, andconcatPinnedU. - Add
toLowerAsciiByteArrayClone. - Add
intercalateByte2. - Add
splitEnd1.
0.2.3.0 – 2020-04-30
- Add
fnv1a32andfnv1a64, implementations of the 32-bit and 64-bit variants of the FNV-1a hash algorithm, to bothData.BytesandData.Bytes.Chunks. - Add
Data.Bytes.Chunks.null. - Add
readFileto bothData.BytesandData.Bytes.Chunks. - Add
foldl'toData.Bytes.Chunks. - Add
splittoData.Bytes.Chunks. - Add
splitStreamfor splitting as a good stream-fusion producer. - Add
hPutandwriteFiletoData.Bytes.Chunks. - Add
fromCString#. - Add
Bytes#newtype on GHC 8.10 and up.
0.2.2.0 – 2020-02-27
- Add
split4. - Add
equalsCString. - Add
stripCStringPrefix. - Add
equalsLatin8. - Add
emptyPinned. - Add
concatPinnedtoData.Bytes.Chunks. - Add
anyandall.
0.2.1.0 – 2020-01-22
- Add
longestCommonPrefix. - Fix broken
Ordinstance ofBytes.
0.2.0.0 – 2020-01-20
- Change behavior of
split. This function previously had a special case for zero-length byte sequences to mirror the behaviorbytestring’s behavior. Now,splitreturns a singleton list with the empty byte sequence in this case. - Add
splitNonEmptyso that users who need to take advantage of the non-null guaranteesplitprovides can do so. - Add
splitUandsplitInitUfor users who are going to split a byte sequence without and consume the results more than once. - Make the C code compile on platforms that do not have
rawmemchr. - Rename
splitOncetosplit1. - Add
split2andsplit3. - Add
equalsLatin{1,2,3,4,5,6,7} - Add
ifoldl'. - Add
hGetandhPut. - Move
Data.Bytes.Chunksfromsmall-bytearray-buildertobyteslice. - Rename
Data.Bytes.Chunks.concattoconcatU(the U means unsliced), and add a newconcatthat returnsBytes. - Add
fromBytes,fromByteArray, andunsafeCopytoData.Bytes.Chunks. - Add
hGetContentstoData.Bytes.Chunks. - Add
isBytePrefixOfandisByteSuffixOf. - Add
replicateandreplicateU. - Add
Monoidinstance forBytes. - Add
singleton,doubleton,tripleton, and their unsliced variants. - Rename
copytounsafeCopy. - Add
fromLatinString. - Change the behavior of
fromAsciiStringto replace out-of-bounds codepoints with NUL. - Add
unsnocanduncons.
0.1.4.0 – 2019-11-12
- Add
toLatinString. - Add
stripPrefix,stripSuffix,stripOptionalPrefix, andstripOptionalSuffix. - Add
takeWhileEndanddropWhileEnd. - Add
count. - Add an optimized
splitfunction. - Add
splitInit. - Add
splitFirst. - Add
copy. - Add
pin. - Add
touch. - Add
elem. - Add
unsafeIndex.
0.1.3.0 – 2019-09-15
- Add
isPrefixOfandisSuffixOf. - Add
foldl,foldr,foldl', andfoldr'.
0.1.2.0 – 2019-08-21
- Add
Data.Bytes.Mutablemodule. - Add
Data.Bytesmodule.
0.1.1.0 – 2019-07-03
- Add record labels for Bytes and MutableBytes
- Add UnmanagedBytes. This is just an Addr and a length.
0.1.0.0 – 2019-04-30
- First version.