Description
Slicing managed and unmanaged memory.
Description
This library provides types that allow the user to talk about a slice of a ByteArray or a MutableByteArray. It also offers UnmanagedBytes, which is kind of like a slice into unmanaged memory. However, it is just an address and a length.
README.md
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.