array-0.5.7.0: Mutable and immutable arrays
Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilitynon-portable (uses Data.Array.Base)
Safe HaskellTrustworthy
LanguageHaskell2010

Data.Array.MArray.Safe

Description

An overloaded interface to mutable arrays. For array types which can be used with this interface, see Data.Array.IO, Data.Array.ST, and Data.Array.Storable. . Safe API only of Data.Array.MArray.

Since: 0.4.0.0

Synopsis

Class of mutable array types

class Monad m => MArray a e m Source #

Class of mutable array types.

An array type has the form (a i e) where a is the array type constructor (kind * -> * -> *), i is the index type (a member of the class Ix), and e is the element type.

The MArray class is parameterised over both a and e (so that instances specialised to certain element types can be defined, in the same way as for IArray), and also over the type of the monad, m, in which the mutable array will be manipulated.

Instances

Instances details
MArray IOUArray Int16 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int16 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int16 -> IO Int Source #

newArray :: Ix i => (i, i) -> Int16 -> IO (IOUArray i Int16) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int16) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int16) Source #

unsafeRead :: Ix i => IOUArray i Int16 -> Int -> IO Int16 Source #

unsafeWrite :: Ix i => IOUArray i Int16 -> Int -> Int16 -> IO () Source #

MArray IOUArray Int32 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int32 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int32 -> IO Int Source #

newArray :: Ix i => (i, i) -> Int32 -> IO (IOUArray i Int32) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int32) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int32) Source #

unsafeRead :: Ix i => IOUArray i Int32 -> Int -> IO Int32 Source #

unsafeWrite :: Ix i => IOUArray i Int32 -> Int -> Int32 -> IO () Source #

MArray IOUArray Int64 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int64 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int64 -> IO Int Source #

newArray :: Ix i => (i, i) -> Int64 -> IO (IOUArray i Int64) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int64) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int64) Source #

unsafeRead :: Ix i => IOUArray i Int64 -> Int -> IO Int64 Source #

unsafeWrite :: Ix i => IOUArray i Int64 -> Int -> Int64 -> IO () Source #

MArray IOUArray Int8 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int8 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int8 -> IO Int Source #

newArray :: Ix i => (i, i) -> Int8 -> IO (IOUArray i Int8) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int8) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int8) Source #

unsafeRead :: Ix i => IOUArray i Int8 -> Int -> IO Int8 Source #

unsafeWrite :: Ix i => IOUArray i Int8 -> Int -> Int8 -> IO () Source #

MArray IOUArray Word16 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word16 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word16 -> IO Int Source #

newArray :: Ix i => (i, i) -> Word16 -> IO (IOUArray i Word16) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word16) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word16) Source #

unsafeRead :: Ix i => IOUArray i Word16 -> Int -> IO Word16 Source #

unsafeWrite :: Ix i => IOUArray i Word16 -> Int -> Word16 -> IO () Source #

MArray IOUArray Word32 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word32 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word32 -> IO Int Source #

newArray :: Ix i => (i, i) -> Word32 -> IO (IOUArray i Word32) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word32) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word32) Source #

unsafeRead :: Ix i => IOUArray i Word32 -> Int -> IO Word32 Source #

unsafeWrite :: Ix i => IOUArray i Word32 -> Int -> Word32 -> IO () Source #

MArray IOUArray Word64 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word64 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word64 -> IO Int Source #

newArray :: Ix i => (i, i) -> Word64 -> IO (IOUArray i Word64) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word64) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word64) Source #

unsafeRead :: Ix i => IOUArray i Word64 -> Int -> IO Word64 Source #

unsafeWrite :: Ix i => IOUArray i Word64 -> Int -> Word64 -> IO () Source #

MArray IOUArray Word8 IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word8 -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word8 -> IO Int Source #

newArray :: Ix i => (i, i) -> Word8 -> IO (IOUArray i Word8) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word8) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word8) Source #

unsafeRead :: Ix i => IOUArray i Word8 -> Int -> IO Word8 Source #

unsafeWrite :: Ix i => IOUArray i Word8 -> Int -> Word8 -> IO () Source #

MArray IOUArray Bool IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Bool -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Bool -> IO Int Source #

newArray :: Ix i => (i, i) -> Bool -> IO (IOUArray i Bool) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Bool) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Bool) Source #

unsafeRead :: Ix i => IOUArray i Bool -> Int -> IO Bool Source #

unsafeWrite :: Ix i => IOUArray i Bool -> Int -> Bool -> IO () Source #

MArray IOUArray Char IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Char -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Char -> IO Int Source #

newArray :: Ix i => (i, i) -> Char -> IO (IOUArray i Char) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Char) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Char) Source #

unsafeRead :: Ix i => IOUArray i Char -> Int -> IO Char Source #

unsafeWrite :: Ix i => IOUArray i Char -> Int -> Char -> IO () Source #

MArray IOUArray Double IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Double -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Double -> IO Int Source #

newArray :: Ix i => (i, i) -> Double -> IO (IOUArray i Double) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Double) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Double) Source #

unsafeRead :: Ix i => IOUArray i Double -> Int -> IO Double Source #

unsafeWrite :: Ix i => IOUArray i Double -> Int -> Double -> IO () Source #

MArray IOUArray Float IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Float -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Float -> IO Int Source #

newArray :: Ix i => (i, i) -> Float -> IO (IOUArray i Float) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Float) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Float) Source #

unsafeRead :: Ix i => IOUArray i Float -> Int -> IO Float Source #

unsafeWrite :: Ix i => IOUArray i Float -> Int -> Float -> IO () Source #

MArray IOUArray Int IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Int -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Int -> IO Int Source #

newArray :: Ix i => (i, i) -> Int -> IO (IOUArray i Int) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Int) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Int) Source #

unsafeRead :: Ix i => IOUArray i Int -> Int -> IO Int Source #

unsafeWrite :: Ix i => IOUArray i Int -> Int -> Int -> IO () Source #

MArray IOUArray Word IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i Word -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i Word -> IO Int Source #

newArray :: Ix i => (i, i) -> Word -> IO (IOUArray i Word) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i Word) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i Word) Source #

unsafeRead :: Ix i => IOUArray i Word -> Int -> IO Word Source #

unsafeWrite :: Ix i => IOUArray i Word -> Int -> Word -> IO () Source #

Storable e => MArray StorableArray e IO Source # 
Instance details

Defined in Data.Array.Storable.Internals

Methods

getBounds :: Ix i => StorableArray i e -> IO (i, i) Source #

getNumElements :: Ix i => StorableArray i e -> IO Int Source #

newArray :: Ix i => (i, i) -> e -> IO (StorableArray i e) Source #

newArray_ :: Ix i => (i, i) -> IO (StorableArray i e) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (StorableArray i e) Source #

unsafeRead :: Ix i => StorableArray i e -> Int -> IO e Source #

unsafeWrite :: Ix i => StorableArray i e -> Int -> e -> IO () Source #

MArray IOArray e IO Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => IOArray i e -> IO (i, i) Source #

getNumElements :: Ix i => IOArray i e -> IO Int Source #

newArray :: Ix i => (i, i) -> e -> IO (IOArray i e) Source #

newArray_ :: Ix i => (i, i) -> IO (IOArray i e) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOArray i e) Source #

unsafeRead :: Ix i => IOArray i e -> Int -> IO e Source #

unsafeWrite :: Ix i => IOArray i e -> Int -> e -> IO () Source #

MArray IOUArray (FunPtr a) IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i (FunPtr a) -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i (FunPtr a) -> IO Int Source #

newArray :: Ix i => (i, i) -> FunPtr a -> IO (IOUArray i (FunPtr a)) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i (FunPtr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i (FunPtr a)) Source #

unsafeRead :: Ix i => IOUArray i (FunPtr a) -> Int -> IO (FunPtr a) Source #

unsafeWrite :: Ix i => IOUArray i (FunPtr a) -> Int -> FunPtr a -> IO () Source #

MArray IOUArray (Ptr a) IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i (Ptr a) -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i (Ptr a) -> IO Int Source #

newArray :: Ix i => (i, i) -> Ptr a -> IO (IOUArray i (Ptr a)) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i (Ptr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i (Ptr a)) Source #

unsafeRead :: Ix i => IOUArray i (Ptr a) -> Int -> IO (Ptr a) Source #

unsafeWrite :: Ix i => IOUArray i (Ptr a) -> Int -> Ptr a -> IO () Source #

MArray IOUArray (StablePtr a) IO Source # 
Instance details

Defined in Data.Array.IO.Internals

Methods

getBounds :: Ix i => IOUArray i (StablePtr a) -> IO (i, i) Source #

getNumElements :: Ix i => IOUArray i (StablePtr a) -> IO Int Source #

newArray :: Ix i => (i, i) -> StablePtr a -> IO (IOUArray i (StablePtr a)) Source #

newArray_ :: Ix i => (i, i) -> IO (IOUArray i (StablePtr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> IO (IOUArray i (StablePtr a)) Source #

unsafeRead :: Ix i => IOUArray i (StablePtr a) -> Int -> IO (StablePtr a) Source #

unsafeWrite :: Ix i => IOUArray i (StablePtr a) -> Int -> StablePtr a -> IO () Source #

MArray (STUArray s) Int16 (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Int16 -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Int16 -> ST s Int Source #

newArray :: Ix i => (i, i) -> Int16 -> ST s (STUArray s i Int16) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int16) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int16) Source #

unsafeRead :: Ix i => STUArray s i Int16 -> Int -> ST s Int16 Source #

unsafeWrite :: Ix i => STUArray s i Int16 -> Int -> Int16 -> ST s () Source #

MArray (STUArray s) Int32 (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Int32 -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Int32 -> ST s Int Source #

newArray :: Ix i => (i, i) -> Int32 -> ST s (STUArray s i Int32) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int32) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int32) Source #

unsafeRead :: Ix i => STUArray s i Int32 -> Int -> ST s Int32 Source #

unsafeWrite :: Ix i => STUArray s i Int32 -> Int -> Int32 -> ST s () Source #

MArray (STUArray s) Int64 (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Int64 -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Int64 -> ST s Int Source #

newArray :: Ix i => (i, i) -> Int64 -> ST s (STUArray s i Int64) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int64) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int64) Source #

unsafeRead :: Ix i => STUArray s i Int64 -> Int -> ST s Int64 Source #

unsafeWrite :: Ix i => STUArray s i Int64 -> Int -> Int64 -> ST s () Source #

MArray (STUArray s) Int8 (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Int8 -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Int8 -> ST s Int Source #

newArray :: Ix i => (i, i) -> Int8 -> ST s (STUArray s i Int8) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int8) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int8) Source #

unsafeRead :: Ix i => STUArray s i Int8 -> Int -> ST s Int8 Source #

unsafeWrite :: Ix i => STUArray s i Int8 -> Int -> Int8 -> ST s () Source #

MArray (STUArray s) Word16 (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Word16 -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Word16 -> ST s Int Source #

newArray :: Ix i => (i, i) -> Word16 -> ST s (STUArray s i Word16) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word16) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word16) Source #

unsafeRead :: Ix i => STUArray s i Word16 -> Int -> ST s Word16 Source #

unsafeWrite :: Ix i => STUArray s i Word16 -> Int -> Word16 -> ST s () Source #

MArray (STUArray s) Word32 (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Word32 -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Word32 -> ST s Int Source #

newArray :: Ix i => (i, i) -> Word32 -> ST s (STUArray s i Word32) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word32) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word32) Source #

unsafeRead :: Ix i => STUArray s i Word32 -> Int -> ST s Word32 Source #

unsafeWrite :: Ix i => STUArray s i Word32 -> Int -> Word32 -> ST s () Source #

MArray (STUArray s) Word64 (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Word64 -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Word64 -> ST s Int Source #

newArray :: Ix i => (i, i) -> Word64 -> ST s (STUArray s i Word64) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word64) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word64) Source #

unsafeRead :: Ix i => STUArray s i Word64 -> Int -> ST s Word64 Source #

unsafeWrite :: Ix i => STUArray s i Word64 -> Int -> Word64 -> ST s () Source #

MArray (STUArray s) Word8 (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Word8 -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Word8 -> ST s Int Source #

newArray :: Ix i => (i, i) -> Word8 -> ST s (STUArray s i Word8) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word8) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word8) Source #

unsafeRead :: Ix i => STUArray s i Word8 -> Int -> ST s Word8 Source #

unsafeWrite :: Ix i => STUArray s i Word8 -> Int -> Word8 -> ST s () Source #

MArray (STUArray s) Bool (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Bool -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Bool -> ST s Int Source #

newArray :: Ix i => (i, i) -> Bool -> ST s (STUArray s i Bool) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Bool) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Bool) Source #

unsafeRead :: Ix i => STUArray s i Bool -> Int -> ST s Bool Source #

unsafeWrite :: Ix i => STUArray s i Bool -> Int -> Bool -> ST s () Source #

MArray (STUArray s) Char (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Char -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Char -> ST s Int Source #

newArray :: Ix i => (i, i) -> Char -> ST s (STUArray s i Char) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Char) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Char) Source #

unsafeRead :: Ix i => STUArray s i Char -> Int -> ST s Char Source #

unsafeWrite :: Ix i => STUArray s i Char -> Int -> Char -> ST s () Source #

MArray (STUArray s) Double (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Double -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Double -> ST s Int Source #

newArray :: Ix i => (i, i) -> Double -> ST s (STUArray s i Double) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Double) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Double) Source #

unsafeRead :: Ix i => STUArray s i Double -> Int -> ST s Double Source #

unsafeWrite :: Ix i => STUArray s i Double -> Int -> Double -> ST s () Source #

MArray (STUArray s) Float (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Float -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Float -> ST s Int Source #

newArray :: Ix i => (i, i) -> Float -> ST s (STUArray s i Float) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Float) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Float) Source #

unsafeRead :: Ix i => STUArray s i Float -> Int -> ST s Float Source #

unsafeWrite :: Ix i => STUArray s i Float -> Int -> Float -> ST s () Source #

MArray (STUArray s) Int (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Int -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Int -> ST s Int Source #

newArray :: Ix i => (i, i) -> Int -> ST s (STUArray s i Int) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int) Source #

unsafeRead :: Ix i => STUArray s i Int -> Int -> ST s Int Source #

unsafeWrite :: Ix i => STUArray s i Int -> Int -> Int -> ST s () Source #

MArray (STUArray s) Word (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i Word -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i Word -> ST s Int Source #

newArray :: Ix i => (i, i) -> Word -> ST s (STUArray s i Word) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word) Source #

unsafeRead :: Ix i => STUArray s i Word -> Int -> ST s Word Source #

unsafeWrite :: Ix i => STUArray s i Word -> Int -> Word -> ST s () Source #

MArray (STArray s) e (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STArray s i e -> ST s (i, i) Source #

getNumElements :: Ix i => STArray s i e -> ST s Int Source #

newArray :: Ix i => (i, i) -> e -> ST s (STArray s i e) Source #

newArray_ :: Ix i => (i, i) -> ST s (STArray s i e) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STArray s i e) Source #

unsafeRead :: Ix i => STArray s i e -> Int -> ST s e Source #

unsafeWrite :: Ix i => STArray s i e -> Int -> e -> ST s () Source #

MArray (STArray s) e (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STArray s i e -> ST s (i, i) Source #

getNumElements :: Ix i => STArray s i e -> ST s Int Source #

newArray :: Ix i => (i, i) -> e -> ST s (STArray s i e) Source #

newArray_ :: Ix i => (i, i) -> ST s (STArray s i e) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STArray s i e) Source #

unsafeRead :: Ix i => STArray s i e -> Int -> ST s e Source #

unsafeWrite :: Ix i => STArray s i e -> Int -> e -> ST s () Source #

MArray (STUArray s) (FunPtr a) (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i (FunPtr a) -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i (FunPtr a) -> ST s Int Source #

newArray :: Ix i => (i, i) -> FunPtr a -> ST s (STUArray s i (FunPtr a)) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i (FunPtr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i (FunPtr a)) Source #

unsafeRead :: Ix i => STUArray s i (FunPtr a) -> Int -> ST s (FunPtr a) Source #

unsafeWrite :: Ix i => STUArray s i (FunPtr a) -> Int -> FunPtr a -> ST s () Source #

MArray (STUArray s) (Ptr a) (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i (Ptr a) -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i (Ptr a) -> ST s Int Source #

newArray :: Ix i => (i, i) -> Ptr a -> ST s (STUArray s i (Ptr a)) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i (Ptr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i (Ptr a)) Source #

unsafeRead :: Ix i => STUArray s i (Ptr a) -> Int -> ST s (Ptr a) Source #

unsafeWrite :: Ix i => STUArray s i (Ptr a) -> Int -> Ptr a -> ST s () Source #

MArray (STUArray s) (StablePtr a) (ST s) Source # 
Instance details

Defined in Data.Array.Base

Methods

getBounds :: Ix i => STUArray s i (StablePtr a) -> ST s (i, i) Source #

getNumElements :: Ix i => STUArray s i (StablePtr a) -> ST s Int Source #

newArray :: Ix i => (i, i) -> StablePtr a -> ST s (STUArray s i (StablePtr a)) Source #

newArray_ :: Ix i => (i, i) -> ST s (STUArray s i (StablePtr a)) Source #

unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i (StablePtr a)) Source #

unsafeRead :: Ix i => STUArray s i (StablePtr a) -> Int -> ST s (StablePtr a) Source #

unsafeWrite :: Ix i => STUArray s i (StablePtr a) -> Int -> StablePtr a -> ST s () Source #

The Ix class and operations

module Data.Ix

Constructing mutable arrays

newArray :: (MArray a e m, Ix i) => (i, i) -> e -> m (a i e) Source #

Builds a new array, with every element initialised to the supplied value. The first and second element of the tuple specifies the lowest and highest index, respectively.

newArray_ :: (MArray a e m, Ix i) => (i, i) -> m (a i e) Source #

Builds a new array, with every element initialised to an undefined value. In a monadic context in which operations must be deterministic (e.g. the ST monad), the array elements are initialised to a fixed but undefined value, such as zero. The first and second element of the tuple specifies the lowest and highest index, respectively.

newListArray :: (MArray a e m, Ix i) => (i, i) -> [e] -> m (a i e) Source #

Constructs a mutable array from a list of initial elements. The list gives the elements of the array in ascending order beginning with the lowest index. The first and second element of the tuple specifies the lowest and highest index, respectively.

newGenArray :: (MArray a e m, Ix i) => (i, i) -> (i -> m e) -> m (a i e) Source #

Constructs a mutable array using a generator function. It invokes the generator function in ascending order of the indices.

Reading and writing mutable arrays

readArray :: (MArray a e m, Ix i) => a i e -> i -> m e Source #

Read an element from a mutable array

writeArray :: (MArray a e m, Ix i) => a i e -> i -> e -> m () Source #

Write an element in a mutable array

Derived arrays

mapArray :: (MArray a e' m, MArray a e m, Ix i) => (e' -> e) -> a i e' -> m (a i e) Source #

Constructs a new array derived from the original array by applying a function to each of the elements.

mapIndices :: (MArray a e m, Ix i, Ix j) => (i, i) -> (i -> j) -> a j e -> m (a i e) Source #

Constructs a new array derived from the original array by applying a function to each of the indices.

Deconstructing mutable arrays

getBounds :: (MArray a e m, Ix i) => a i e -> m (i, i) Source #

Returns the bounds of the array (lowest,highest).

getElems :: (MArray a e m, Ix i) => a i e -> m [e] Source #

Return a list of all the elements of a mutable array

getAssocs :: (MArray a e m, Ix i) => a i e -> m [(i, e)] Source #

Return a list of all the associations of a mutable array, in index order.

Conversions between mutable and immutable arrays

freeze :: (Ix i, MArray a e m, IArray b e) => a i e -> m (b i e) Source #

Converts a mutable array (any instance of MArray) to an immutable array (any instance of IArray) by taking a complete copy of it.

thaw :: (Ix i, IArray a e, MArray b e m) => a i e -> m (b i e) Source #

Converts an immutable array (any instance of IArray) into a mutable array (any instance of MArray) by taking a complete copy of it.