4.17. MutableArray

NOTE: The MutableArray interface is deprecated, please use MArray (Section 4.16) instead.

The MutableArray interface provide operations for reading and writing values to mutable arrays. There's two kinds of mutable arrays, the mutatable version of Haskell Arrays and mutable byte arrays, chunks of memory containing values of some basic type.

4.17.1. Mutable arrays

The mutable array section of the API provides the following operations:


-- mutable arrays:
newArray      :: Ix ix -> (ix,ix) -> elt -> ST s (MutableArray s ix elt)
boundsOfArray :: Ix ix => MutableArray s ix elt -> (ix, ix)
readArray     :: Ix ix => MutableArray s ix elt -> ix -> ST s elt
writeArray    :: Ix ix => MutableArray s ix elt -> ix -> elt -> ST s ()
freezeArray   :: Ix ix => MutableArray s ix elt -> ST s (Array ix elt)
thawArray     :: Ix ix => Array ix elt -> ST s (MutableArray s ix elt)

unsafeFreezeArray   :: Ix ix => MutableArray s ix elt -> ST s (Array ix elt)
unsafeThawArray     :: Ix ix => Array ix elt -> ST s (MutableArray s ix elt)

Remarks:

4.17.2. Mutable byte arrays

-- creators:
newCharArray      :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix)
newAddrArray      :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix)
newIntArray       :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix)
newWordArray      :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix)
newFloatArray     :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix)
newDoubleArray    :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix)
newStablePtrArray :: Ix ix => (ix,ix) -> ST s (MutableByteArray s ix)

boundsOfMutableByteArray
                   :: Ix ix => MutableByteArray s ix -> (ix, ix)

readCharArray      :: Ix ix => MutableByteArray s ix -> ix -> ST s Char
readIntArray       :: Ix ix => MutableByteArray s ix -> ix -> ST s Int
readAddrArray      :: Ix ix => MutableByteArray s ix -> ix -> ST s Addr
readFloatArray     :: Ix ix => MutableByteArray s ix -> ix -> ST s Float
readDoubleArray    :: Ix ix => MutableByteArray s ix -> ix -> ST s Double
readStablePtrArray :: Ix ix => MutableByteArray s ix -> ix -> ST s (StablePtr a)
readWord8Array	   :: Ix ix => MutableByteArray s ix -> ix -> ST s Word8
readWord16Array	   :: Ix ix => MutableByteArray s ix -> ix -> ST s Word16
readWord32Array	   :: Ix ix => MutableByteArray s ix -> ix -> ST s Word32
readWord64Array	   :: Ix ix => MutableByteArray s ix -> ix -> ST s Word64
readInt8Array	   :: Ix ix => MutableByteArray s ix -> ix -> ST s Int8
readInt16Array	   :: Ix ix => MutableByteArray s ix -> ix -> ST s Int16
readInt32Array	   :: Ix ix => MutableByteArray s ix -> ix -> ST s Int32
readInt64Array	   :: Ix ix => MutableByteArray s ix -> ix -> ST s Int64

writeCharArray        :: Ix ix => MutableByteArray s ix -> ix -> Char -> ST s ()
writeIntArray         :: Ix ix => MutableByteArray s ix -> ix -> Int  -> ST s ()
writeAddrArray        :: Ix ix => MutableByteArray s ix -> ix -> Addr -> ST s ()
writeFloatArray       :: Ix ix => MutableByteArray s ix -> ix -> Float -> ST s ()
writeDoubleArray      :: Ix ix => MutableByteArray s ix -> ix -> Double -> ST s ()
writeStablePtrArray   :: Ix ix => MutableByteArray s ix -> ix -> StablePtr a -> ST s ()
writeWord8Array	      :: Ix ix => MutableByteArray s ix -> ix -> Word8  -> ST s ()
writeWord16Array      :: Ix ix => MutableByteArray s ix -> ix -> Word16 -> ST s ()
writeWord32Array      :: Ix ix => MutableByteArray s ix -> ix -> Word32 -> ST s ()
writeWord64Array      :: Ix ix => MutableByteArray s ix -> ix -> Word64 -> ST s ()
writeInt8Array	      :: Ix ix => MutableByteArray s ix -> ix -> Int8  -> ST s ()
writeInt16Array       :: Ix ix => MutableByteArray s ix -> ix -> Int16 -> ST s ()
writeInt32Array	      :: Ix ix => MutableByteArray s ix -> ix -> Int32 -> ST s ()
writeInt64Array	      :: Ix ix => MutableByteArray s ix -> ix -> Int64 -> ST s ()

freezeByteArray       :: Ix ix => MutableByteArray s ix -> ST s (ByteArray ix)
unsafeFreezeByteArray  :: Ix ix => MutableByteArray s ix -> ST s (ByteArray ix)

sizeofMutableByteArray :: Ix ix => MutableByteArray s ix -> Int

thawByteArray       :: Ix ix => ByteArray ixt -> ST s (MutableByteArray s ix)
unsafeThawByteArray :: Ix ix => ByteArray ixt -> ST s (MutableByteArray s ix)

Remarks: