impure-containers-0.5.1: Mutable containers in Haskell.

Safe HaskellNone
LanguageHaskell2010

ImpureContainers.MByteArray

Contents

Description

FIXME: doc

Synopsis

MByteArray

type MByteArray s = MutableByteArray s Source #

FIXME: doc

underlyingMutableByteArray# Source #

Arguments

:: MByteArray s

FIXME: doc

-> MutableByteArray# s

FIXME: doc

FIXME: doc

Creation

new Source #

Arguments

:: PrimMonad m 
=> Int

FIXME: doc

-> m (MByteArray (PrimState m))

FIXME: doc

Create a new mutable byte array of the specified size in bytes.

newPinned Source #

Arguments

:: PrimMonad m 
=> Int

FIXME: doc

-> m (MByteArray (PrimState m))

FIXME: doc

Create a pinned byte array of the specified size in bytes. The garbage collector is guaranteed not to move it.

newAlignedPinned Source #

Arguments

:: PrimMonad m 
=> Int

FIXME: doc

-> Int

FIXME: doc

-> m (MByteArray (PrimState m))

FIXME: doc

Create a pinned byte array of the specified size in bytes and with the give alignment. The garbage collector is guaranteed not to move it.

Element access

read Source #

Arguments

:: (Prim a, PrimMonad m) 
=> MByteArray (PrimState m)

FIXME: doc

-> Int

FIXME: doc

-> m a

FIXME: doc

Read a primitive value from the byte array. The offset is given in elements of type a rather than in bytes.

write Source #

Arguments

:: (Prim a, PrimMonad m) 
=> MByteArray (PrimState m)

FIXME: doc

-> Int

FIXME: doc

-> a

FIXME: doc

-> m ()

FIXME: doc

Write a primitive value to the byte array. The offset is given in elements of type a rather than in bytes.

Freezing and thawing

unsafeFreeze Source #

Arguments

:: PrimMonad m 
=> MByteArray (PrimState m)

FIXME: doc

-> m IByteArray

FIXME: doc

Convert a mutable byte array to an immutable one without copying. The array should not be modified after the conversion.

unsafeThaw Source #

Arguments

:: PrimMonad m 
=> IByteArray

FIXME: doc

-> m (MByteArray (PrimState m))

FIXME: doc

Convert an immutable byte array to a mutable one without copying. The original array should not be used after the conversion.

Block operations

copyFromIByteArray Source #

Arguments

:: PrimMonad m 
=> MByteArray (PrimState m)
FIXME: doc
destination array
-> Int
FIXME: doc
offset into destination array
-> IByteArray
FIXME: doc
source array
-> Int
FIXME: doc
offset into source array
-> Int
FIXME: doc
number of bytes to copy
-> m ()

FIXME: doc

Copy a slice of an immutable byte array to a mutable byte array.

copyFromMByteArray Source #

Arguments

:: PrimMonad m 
=> MByteArray (PrimState m)
FIXME: doc
destination array
-> Int
FIXME: doc
offset into destination array
-> MByteArray (PrimState m)
FIXME: doc
source array
-> Int
FIXME: doc
offset into source array
-> Int
FIXME: doc
number of bytes to copy
-> m ()

FIXME: doc

Copy a slice of a mutable byte array into another array. The two slices must not overlap.

move Source #

Arguments

:: PrimMonad m 
=> MByteArray (PrimState m)
FIXME: doc
destination array
-> Int
FIXME: doc
offset into destination array
-> MByteArray (PrimState m)
FIXME: doc
source array
-> Int
FIXME: doc
offset into source array
-> Int
FIXME: doc
number of bytes to copy
-> m ()

FIXME: doc

Copy a slice of a mutable byte array into another array. The given arrays are allowed to overlap.

set Source #

Arguments

:: (Prim a, PrimMonad m) 
=> MByteArray (PrimState m)
FIXME: doc
array to fill
-> Int
FIXME: doc
offset into array
-> Int
FIXME: doc
number of values to fill
-> a
FIXME: doc
value to fill with
-> m ()

FIXME: doc

Fill a slice of a mutable byte array with a value.

The offset and length parameters are given as a number of elements of type a rather than in bytes. In other words, the offset and length work like C arrays, rather than like C pointers.

fill Source #

Arguments

:: PrimMonad m 
=> MByteArray (PrimState m)
FIXME: doc
array to fill
-> Int
FIXME: doc
offset into array
-> Int
FIXME: doc
number of bytes to fill
-> Word8
FIXME: doc
byte to fill with
-> m ()

FIXME: doc

Fill a slice of a mutable byte array with a byte.

Information

sizeof Source #

Arguments

:: MByteArray s

FIXME: doc

-> Int

FIXME: doc

Size of the mutable byte array in bytes.

same Source #

Arguments

:: MByteArray s

FIXME: doc

-> MByteArray s

FIXME: doc

-> Bool

FIXME: doc

Check if the two arrays refer to the same memory block.

contents Source #

Arguments

:: MByteArray s

FIXME: doc

-> Ptr Word8

FIXME: doc

Yield a pointer to the array's data. This operation is only safe on pinned byte arrays allocated by newPinnedByteArray or newAlignedPinnedByteArray.