| |||||||
| |||||||
Description | |||||||
Primitive operations on ByteArrays | |||||||
Synopsis | |||||||
Documentation | |||||||
data ByteArray | |||||||
| |||||||
data MutableByteArray s | |||||||
| |||||||
data ByteArray# | |||||||
data MutableByteArray# a | |||||||
newByteArray :: PrimMonad m => Int -> m (MutableByteArray (PrimState m)) | |||||||
Create a new mutable byte array of the specified size. | |||||||
newPinnedByteArray :: PrimMonad m => Int -> m (MutableByteArray (PrimState m)) | |||||||
Create a pinned byte array of the specified size. The garbage collector is guaranteed not to move it. | |||||||
newAlignedPinnedByteArray :: PrimMonad m => Int -> Int -> m (MutableByteArray (PrimState m)) | |||||||
Create a pinned byte array of the specified size and with the give alignment. The garbage collector is guaranteed not to move it. | |||||||
readByteArray :: (Prim a, PrimMonad m) => MutableByteArray (PrimState m) -> Int -> m a | |||||||
Read a primitive value from the byte array. The offset is given in elements of type a rather than in bytes. | |||||||
writeByteArray :: (Prim a, PrimMonad m) => MutableByteArray (PrimState m) -> Int -> a -> m () | |||||||
Write a primitive value to the byte array. The offset is given in elements of type a rather than in bytes. | |||||||
indexByteArray :: Prim a => ByteArray -> Int -> a | |||||||
Read a primitive value from the byte array. The offset is given in elements of type a rather than in bytes. | |||||||
unsafeFreezeByteArray :: PrimMonad m => MutableByteArray (PrimState m) -> m ByteArray | |||||||
Convert a mutable byte array to an immutable one without copying. The array should not be modified after the conversion. | |||||||
unsafeThawByteArray :: PrimMonad m => ByteArray -> m (MutableByteArray (PrimState m)) | |||||||
Convert an immutable byte array to a mutable one without copying. The original array should not be used after the conversion. | |||||||
sizeofByteArray :: ByteArray -> Int | |||||||
Size of the byte array. | |||||||
sizeofMutableByteArray :: MutableByteArray s -> Int | |||||||
Size of the mutable byte array. | |||||||
sameMutableByteArray :: MutableByteArray s -> MutableByteArray s -> Bool | |||||||
Check if the two arrays refer to the same memory block. | |||||||
byteArrayContents :: ByteArray -> Addr | |||||||
Yield a pointer to the array's data. This operation is only safe on pinned byte arrays allocated by newPinnedByteArray or newAlignedPinnedByteArray. | |||||||
mutableByteArrayContents :: MutableByteArray s -> Addr | |||||||
Yield a pointer to the array's data. This operation is only safe on pinned byte arrays allocated by newPinnedByteArray or newAlignedPinnedByteArray. | |||||||
memcpyByteArray :: PrimMonad m => MutableByteArray (PrimState m) -> Int -> MutableByteArray (PrimState m) -> Int -> Int -> m () | |||||||
memcpyByteArray' :: PrimMonad m => MutableByteArray (PrimState m) -> Int -> ByteArray -> Int -> Int -> m () | |||||||
memmoveByteArray :: PrimMonad m => MutableByteArray (PrimState m) -> Int -> MutableByteArray (PrimState m) -> Int -> Int -> m () | |||||||
memsetByteArray :: PrimMonad m => MutableByteArray (PrimState m) -> Int -> Word8 -> Int -> m () | |||||||
Produced by Haddock version 2.7.2 |