array-0.5.6.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 (MPTCs, uses Control.Monad.ST)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Array.Base

Description

Basis for IArray and MArray. Not intended for external consumption; use IArray or MArray instead.

WARNING

This module is considered internal.

The Package Versioning Policy does not apply.

The contents of this module may change in any way whatsoever and without any warning between minor versions of this package.

Authors importing this module are expected to track development closely.

Synopsis

Documentation

class IArray a e where Source #

Class of immutable 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 IArray class is parameterised over both a and e, so that instances specialised to certain element types can be defined.

Minimal complete definition

bounds, numElements, unsafeArray, unsafeAt

Methods

bounds :: Ix i => a i e -> (i, i) Source #

Extracts the bounds of an immutable array

numElements :: Ix i => a i e -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, e)] -> a i e Source #

unsafeAt :: Ix i => a i e -> Int -> e Source #

unsafeReplace :: Ix i => a i e -> [(Int, e)] -> a i e Source #

unsafeAccum :: Ix i => (e -> e' -> e) -> a i e -> [(Int, e')] -> a i e Source #

unsafeAccumArray :: Ix i => (e -> e' -> e) -> e -> (i, i) -> [(Int, e')] -> a i e Source #

Instances

Instances details
IArray UArray Int16 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int16 -> (i, i) Source #

numElements :: Ix i => UArray i Int16 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int16)] -> UArray i Int16 Source #

unsafeAt :: Ix i => UArray i Int16 -> Int -> Int16 Source #

unsafeReplace :: Ix i => UArray i Int16 -> [(Int, Int16)] -> UArray i Int16 Source #

unsafeAccum :: Ix i => (Int16 -> e' -> Int16) -> UArray i Int16 -> [(Int, e')] -> UArray i Int16 Source #

unsafeAccumArray :: Ix i => (Int16 -> e' -> Int16) -> Int16 -> (i, i) -> [(Int, e')] -> UArray i Int16 Source #

IArray UArray Int32 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int32 -> (i, i) Source #

numElements :: Ix i => UArray i Int32 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int32)] -> UArray i Int32 Source #

unsafeAt :: Ix i => UArray i Int32 -> Int -> Int32 Source #

unsafeReplace :: Ix i => UArray i Int32 -> [(Int, Int32)] -> UArray i Int32 Source #

unsafeAccum :: Ix i => (Int32 -> e' -> Int32) -> UArray i Int32 -> [(Int, e')] -> UArray i Int32 Source #

unsafeAccumArray :: Ix i => (Int32 -> e' -> Int32) -> Int32 -> (i, i) -> [(Int, e')] -> UArray i Int32 Source #

IArray UArray Int64 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int64 -> (i, i) Source #

numElements :: Ix i => UArray i Int64 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int64)] -> UArray i Int64 Source #

unsafeAt :: Ix i => UArray i Int64 -> Int -> Int64 Source #

unsafeReplace :: Ix i => UArray i Int64 -> [(Int, Int64)] -> UArray i Int64 Source #

unsafeAccum :: Ix i => (Int64 -> e' -> Int64) -> UArray i Int64 -> [(Int, e')] -> UArray i Int64 Source #

unsafeAccumArray :: Ix i => (Int64 -> e' -> Int64) -> Int64 -> (i, i) -> [(Int, e')] -> UArray i Int64 Source #

IArray UArray Int8 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int8 -> (i, i) Source #

numElements :: Ix i => UArray i Int8 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int8)] -> UArray i Int8 Source #

unsafeAt :: Ix i => UArray i Int8 -> Int -> Int8 Source #

unsafeReplace :: Ix i => UArray i Int8 -> [(Int, Int8)] -> UArray i Int8 Source #

unsafeAccum :: Ix i => (Int8 -> e' -> Int8) -> UArray i Int8 -> [(Int, e')] -> UArray i Int8 Source #

unsafeAccumArray :: Ix i => (Int8 -> e' -> Int8) -> Int8 -> (i, i) -> [(Int, e')] -> UArray i Int8 Source #

IArray UArray Word16 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word16 -> (i, i) Source #

numElements :: Ix i => UArray i Word16 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word16)] -> UArray i Word16 Source #

unsafeAt :: Ix i => UArray i Word16 -> Int -> Word16 Source #

unsafeReplace :: Ix i => UArray i Word16 -> [(Int, Word16)] -> UArray i Word16 Source #

unsafeAccum :: Ix i => (Word16 -> e' -> Word16) -> UArray i Word16 -> [(Int, e')] -> UArray i Word16 Source #

unsafeAccumArray :: Ix i => (Word16 -> e' -> Word16) -> Word16 -> (i, i) -> [(Int, e')] -> UArray i Word16 Source #

IArray UArray Word32 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word32 -> (i, i) Source #

numElements :: Ix i => UArray i Word32 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word32)] -> UArray i Word32 Source #

unsafeAt :: Ix i => UArray i Word32 -> Int -> Word32 Source #

unsafeReplace :: Ix i => UArray i Word32 -> [(Int, Word32)] -> UArray i Word32 Source #

unsafeAccum :: Ix i => (Word32 -> e' -> Word32) -> UArray i Word32 -> [(Int, e')] -> UArray i Word32 Source #

unsafeAccumArray :: Ix i => (Word32 -> e' -> Word32) -> Word32 -> (i, i) -> [(Int, e')] -> UArray i Word32 Source #

IArray UArray Word64 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word64 -> (i, i) Source #

numElements :: Ix i => UArray i Word64 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word64)] -> UArray i Word64 Source #

unsafeAt :: Ix i => UArray i Word64 -> Int -> Word64 Source #

unsafeReplace :: Ix i => UArray i Word64 -> [(Int, Word64)] -> UArray i Word64 Source #

unsafeAccum :: Ix i => (Word64 -> e' -> Word64) -> UArray i Word64 -> [(Int, e')] -> UArray i Word64 Source #

unsafeAccumArray :: Ix i => (Word64 -> e' -> Word64) -> Word64 -> (i, i) -> [(Int, e')] -> UArray i Word64 Source #

IArray UArray Word8 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word8 -> (i, i) Source #

numElements :: Ix i => UArray i Word8 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word8)] -> UArray i Word8 Source #

unsafeAt :: Ix i => UArray i Word8 -> Int -> Word8 Source #

unsafeReplace :: Ix i => UArray i Word8 -> [(Int, Word8)] -> UArray i Word8 Source #

unsafeAccum :: Ix i => (Word8 -> e' -> Word8) -> UArray i Word8 -> [(Int, e')] -> UArray i Word8 Source #

unsafeAccumArray :: Ix i => (Word8 -> e' -> Word8) -> Word8 -> (i, i) -> [(Int, e')] -> UArray i Word8 Source #

IArray UArray Bool Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Bool -> (i, i) Source #

numElements :: Ix i => UArray i Bool -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Bool)] -> UArray i Bool Source #

unsafeAt :: Ix i => UArray i Bool -> Int -> Bool Source #

unsafeReplace :: Ix i => UArray i Bool -> [(Int, Bool)] -> UArray i Bool Source #

unsafeAccum :: Ix i => (Bool -> e' -> Bool) -> UArray i Bool -> [(Int, e')] -> UArray i Bool Source #

unsafeAccumArray :: Ix i => (Bool -> e' -> Bool) -> Bool -> (i, i) -> [(Int, e')] -> UArray i Bool Source #

IArray UArray Char Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Char -> (i, i) Source #

numElements :: Ix i => UArray i Char -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Char)] -> UArray i Char Source #

unsafeAt :: Ix i => UArray i Char -> Int -> Char Source #

unsafeReplace :: Ix i => UArray i Char -> [(Int, Char)] -> UArray i Char Source #

unsafeAccum :: Ix i => (Char -> e' -> Char) -> UArray i Char -> [(Int, e')] -> UArray i Char Source #

unsafeAccumArray :: Ix i => (Char -> e' -> Char) -> Char -> (i, i) -> [(Int, e')] -> UArray i Char Source #

IArray UArray Double Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Double -> (i, i) Source #

numElements :: Ix i => UArray i Double -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Double)] -> UArray i Double Source #

unsafeAt :: Ix i => UArray i Double -> Int -> Double Source #

unsafeReplace :: Ix i => UArray i Double -> [(Int, Double)] -> UArray i Double Source #

unsafeAccum :: Ix i => (Double -> e' -> Double) -> UArray i Double -> [(Int, e')] -> UArray i Double Source #

unsafeAccumArray :: Ix i => (Double -> e' -> Double) -> Double -> (i, i) -> [(Int, e')] -> UArray i Double Source #

IArray UArray Float Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Float -> (i, i) Source #

numElements :: Ix i => UArray i Float -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Float)] -> UArray i Float Source #

unsafeAt :: Ix i => UArray i Float -> Int -> Float Source #

unsafeReplace :: Ix i => UArray i Float -> [(Int, Float)] -> UArray i Float Source #

unsafeAccum :: Ix i => (Float -> e' -> Float) -> UArray i Float -> [(Int, e')] -> UArray i Float Source #

unsafeAccumArray :: Ix i => (Float -> e' -> Float) -> Float -> (i, i) -> [(Int, e')] -> UArray i Float Source #

IArray UArray Int Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int -> (i, i) Source #

numElements :: Ix i => UArray i Int -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int)] -> UArray i Int Source #

unsafeAt :: Ix i => UArray i Int -> Int -> Int Source #

unsafeReplace :: Ix i => UArray i Int -> [(Int, Int)] -> UArray i Int Source #

unsafeAccum :: Ix i => (Int -> e' -> Int) -> UArray i Int -> [(Int, e')] -> UArray i Int Source #

unsafeAccumArray :: Ix i => (Int -> e' -> Int) -> Int -> (i, i) -> [(Int, e')] -> UArray i Int Source #

IArray UArray Word Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word -> (i, i) Source #

numElements :: Ix i => UArray i Word -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word)] -> UArray i Word Source #

unsafeAt :: Ix i => UArray i Word -> Int -> Word Source #

unsafeReplace :: Ix i => UArray i Word -> [(Int, Word)] -> UArray i Word Source #

unsafeAccum :: Ix i => (Word -> e' -> Word) -> UArray i Word -> [(Int, e')] -> UArray i Word Source #

unsafeAccumArray :: Ix i => (Word -> e' -> Word) -> Word -> (i, i) -> [(Int, e')] -> UArray i Word Source #

IArray Array e Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => Array i e -> (i, i) Source #

numElements :: Ix i => Array i e -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, e)] -> Array i e Source #

unsafeAt :: Ix i => Array i e -> Int -> e Source #

unsafeReplace :: Ix i => Array i e -> [(Int, e)] -> Array i e Source #

unsafeAccum :: Ix i => (e -> e' -> e) -> Array i e -> [(Int, e')] -> Array i e Source #

unsafeAccumArray :: Ix i => (e -> e' -> e) -> e -> (i, i) -> [(Int, e')] -> Array i e Source #

IArray UArray (FunPtr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (FunPtr a) -> (i, i) Source #

numElements :: Ix i => UArray i (FunPtr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, FunPtr a)] -> UArray i (FunPtr a) Source #

unsafeAt :: Ix i => UArray i (FunPtr a) -> Int -> FunPtr a Source #

unsafeReplace :: Ix i => UArray i (FunPtr a) -> [(Int, FunPtr a)] -> UArray i (FunPtr a) Source #

unsafeAccum :: Ix i => (FunPtr a -> e' -> FunPtr a) -> UArray i (FunPtr a) -> [(Int, e')] -> UArray i (FunPtr a) Source #

unsafeAccumArray :: Ix i => (FunPtr a -> e' -> FunPtr a) -> FunPtr a -> (i, i) -> [(Int, e')] -> UArray i (FunPtr a) Source #

IArray UArray (Ptr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (Ptr a) -> (i, i) Source #

numElements :: Ix i => UArray i (Ptr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Ptr a)] -> UArray i (Ptr a) Source #

unsafeAt :: Ix i => UArray i (Ptr a) -> Int -> Ptr a Source #

unsafeReplace :: Ix i => UArray i (Ptr a) -> [(Int, Ptr a)] -> UArray i (Ptr a) Source #

unsafeAccum :: Ix i => (Ptr a -> e' -> Ptr a) -> UArray i (Ptr a) -> [(Int, e')] -> UArray i (Ptr a) Source #

unsafeAccumArray :: Ix i => (Ptr a -> e' -> Ptr a) -> Ptr a -> (i, i) -> [(Int, e')] -> UArray i (Ptr a) Source #

IArray UArray (StablePtr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (StablePtr a) -> (i, i) Source #

numElements :: Ix i => UArray i (StablePtr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, StablePtr a)] -> UArray i (StablePtr a) Source #

unsafeAt :: Ix i => UArray i (StablePtr a) -> Int -> StablePtr a Source #

unsafeReplace :: Ix i => UArray i (StablePtr a) -> [(Int, StablePtr a)] -> UArray i (StablePtr a) Source #

unsafeAccum :: Ix i => (StablePtr a -> e' -> StablePtr a) -> UArray i (StablePtr a) -> [(Int, e')] -> UArray i (StablePtr a) Source #

unsafeAccumArray :: Ix i => (StablePtr a -> e' -> StablePtr a) -> StablePtr a -> (i, i) -> [(Int, e')] -> UArray i (StablePtr a) Source #

safeRangeSize :: Ix i => (i, i) -> Int Source #

safeIndex :: Ix i => (i, i) -> Int -> i -> Int Source #

unsafeReplaceST :: (IArray a e, Ix i) => a i e -> [(Int, e)] -> ST s (STArray s i e) Source #

unsafeAccumST :: (IArray a e, Ix i) => (e -> e' -> e) -> a i e -> [(Int, e')] -> ST s (STArray s i e) Source #

unsafeAccumArrayST :: Ix i => (e -> e' -> e) -> e -> (i, i) -> [(Int, e')] -> ST s (STArray s i e) Source #

array Source #

Arguments

:: (IArray a e, Ix i) 
=> (i, i)

bounds of the array: (lowest,highest)

-> [(i, e)]

list of associations

-> a i e 

Constructs an immutable array from a pair of bounds and a list of initial associations.

The bounds are specified as a pair of the lowest and highest bounds in the array respectively. For example, a one-origin vector of length 10 has bounds (1,10), and a one-origin 10 by 10 matrix has bounds ((1,1),(10,10)).

An association is a pair of the form (i,x), which defines the value of the array at index i to be x. The array is undefined if any index in the list is out of bounds. If any two associations in the list have the same index, the value at that index is implementation-dependent. (In GHC, the last value specified for that index is used. Other implementations will also do this for unboxed arrays, but Haskell 98 requires that for Array the value at such indices is bottom.)

Because the indices must be checked for these errors, array is strict in the bounds argument and in the indices of the association list. Whether array is strict or non-strict in the elements depends on the array type: Array is a non-strict array type, but all of the UArray arrays are strict. Thus in a non-strict array, recurrences such as the following are possible:

a = array (1,100) ((1,1) : [(i, i * a!(i-1)) | i \<- [2..100]])

Not every index within the bounds of the array need appear in the association list, but the values associated with indices that do not appear will be undefined.

If, in any dimension, the lower bound is greater than the upper bound, then the array is legal, but empty. Indexing an empty array always gives an array-bounds error, but bounds still yields the bounds with which the array was constructed.

listArray :: (IArray a e, Ix i) => (i, i) -> [e] -> a i e Source #

Constructs an immutable array from a list of initial elements. The list gives the elements of the array in ascending order beginning with the lowest index.

genArray :: (IArray a e, Ix i) => (i, i) -> (i -> e) -> a i e Source #

Constructs an immutable array using a generator function.

listArrayST :: Ix i => (i, i) -> [e] -> ST s (STArray s i e) Source #

listUArrayST :: (MArray (STUArray s) e (ST s), Ix i) => (i, i) -> [e] -> ST s (STUArray s i e) Source #

type ListUArray e = forall i. Ix i => (i, i) -> [e] -> UArray i e Source #

(!) :: (IArray a e, Ix i) => a i e -> i -> e Source #

Returns the element of an immutable array at the specified index, or throws an exception if the index is out of bounds.

(!?) :: (IArray a e, Ix i) => a i e -> i -> Maybe e Source #

Returns Just the element of an immutable array at the specified index, or Nothing if the index is out of bounds.

indices :: (IArray a e, Ix i) => a i e -> [i] Source #

Returns a list of all the valid indices in an array.

elems :: (IArray a e, Ix i) => a i e -> [e] Source #

Returns a list of all the elements of an array, in the same order as their indices.

assocs :: (IArray a e, Ix i) => a i e -> [(i, e)] Source #

Returns the contents of an array as a list of associations.

accumArray Source #

Arguments

:: (IArray a e, Ix i) 
=> (e -> e' -> e)

An accumulating function

-> e

A default element

-> (i, i)

The bounds of the array

-> [(i, e')]

List of associations

-> a i e

Returns: the array

Constructs an immutable array from a list of associations. Unlike array, the same index is allowed to occur multiple times in the list of associations; an accumulating function is used to combine the values of elements with the same index.

For example, given a list of values of some index type, hist produces a histogram of the number of occurrences of each index within a specified range:

hist :: (Ix a, Num b) => (a,a) -> [a] -> Array a b
hist bnds is = accumArray (+) 0 bnds [(i, 1) | i\<-is, inRange bnds i]

(//) :: (IArray a e, Ix i) => a i e -> [(i, e)] -> a i e Source #

Takes an array and a list of pairs and returns an array identical to the left argument except that it has been updated by the associations in the right argument. For example, if m is a 1-origin, n by n matrix, then m//[((i,i), 0) | i <- [1..n]] is the same matrix, except with the diagonal zeroed.

As with the array function, if any two associations in the list have the same index, the value at that index is implementation-dependent. (In GHC, the last value specified for that index is used. Other implementations will also do this for unboxed arrays, but Haskell 98 requires that for Array the value at such indices is bottom.)

For most array types, this operation is O(n) where n is the size of the array. However, the diffarray package provides an array type for which this operation has complexity linear in the number of updates.

accum :: (IArray a e, Ix i) => (e -> e' -> e) -> a i e -> [(i, e')] -> a i e Source #

accum f takes an array and an association list and accumulates pairs from the list into the array with the accumulating function f. Thus accumArray can be defined using accum:

accumArray f z b = accum f (array b [(i, z) | i \<- range b])

amap :: (IArray a e', IArray a e, Ix i) => (e' -> e) -> a i e' -> a i e Source #

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

ixmap :: (IArray a e, Ix i, Ix j) => (i, i) -> (i -> j) -> a j e -> a i e Source #

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

data UArray i e Source #

Arrays with unboxed elements. Instances of IArray are provided for UArray with certain element types (Int, Float, Char, etc.; see the UArray class for a full list).

A UArray will generally be more efficient (in terms of both time and space) than the equivalent Array with the same element type. However, UArray is strict in its elements - so don't use UArray if you require the non-strictness that Array provides.

Because the IArray interface provides operations overloaded on the type of the array, it should be possible to just change the array type being used by a program from say Array to UArray to get the benefits of unboxed arrays (don't forget to import Data.Array.Unboxed instead of Data.Array).

Constructors

UArray !i !i !Int ByteArray# 

Instances

Instances details
IArray UArray Int16 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int16 -> (i, i) Source #

numElements :: Ix i => UArray i Int16 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int16)] -> UArray i Int16 Source #

unsafeAt :: Ix i => UArray i Int16 -> Int -> Int16 Source #

unsafeReplace :: Ix i => UArray i Int16 -> [(Int, Int16)] -> UArray i Int16 Source #

unsafeAccum :: Ix i => (Int16 -> e' -> Int16) -> UArray i Int16 -> [(Int, e')] -> UArray i Int16 Source #

unsafeAccumArray :: Ix i => (Int16 -> e' -> Int16) -> Int16 -> (i, i) -> [(Int, e')] -> UArray i Int16 Source #

IArray UArray Int32 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int32 -> (i, i) Source #

numElements :: Ix i => UArray i Int32 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int32)] -> UArray i Int32 Source #

unsafeAt :: Ix i => UArray i Int32 -> Int -> Int32 Source #

unsafeReplace :: Ix i => UArray i Int32 -> [(Int, Int32)] -> UArray i Int32 Source #

unsafeAccum :: Ix i => (Int32 -> e' -> Int32) -> UArray i Int32 -> [(Int, e')] -> UArray i Int32 Source #

unsafeAccumArray :: Ix i => (Int32 -> e' -> Int32) -> Int32 -> (i, i) -> [(Int, e')] -> UArray i Int32 Source #

IArray UArray Int64 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int64 -> (i, i) Source #

numElements :: Ix i => UArray i Int64 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int64)] -> UArray i Int64 Source #

unsafeAt :: Ix i => UArray i Int64 -> Int -> Int64 Source #

unsafeReplace :: Ix i => UArray i Int64 -> [(Int, Int64)] -> UArray i Int64 Source #

unsafeAccum :: Ix i => (Int64 -> e' -> Int64) -> UArray i Int64 -> [(Int, e')] -> UArray i Int64 Source #

unsafeAccumArray :: Ix i => (Int64 -> e' -> Int64) -> Int64 -> (i, i) -> [(Int, e')] -> UArray i Int64 Source #

IArray UArray Int8 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int8 -> (i, i) Source #

numElements :: Ix i => UArray i Int8 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int8)] -> UArray i Int8 Source #

unsafeAt :: Ix i => UArray i Int8 -> Int -> Int8 Source #

unsafeReplace :: Ix i => UArray i Int8 -> [(Int, Int8)] -> UArray i Int8 Source #

unsafeAccum :: Ix i => (Int8 -> e' -> Int8) -> UArray i Int8 -> [(Int, e')] -> UArray i Int8 Source #

unsafeAccumArray :: Ix i => (Int8 -> e' -> Int8) -> Int8 -> (i, i) -> [(Int, e')] -> UArray i Int8 Source #

IArray UArray Word16 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word16 -> (i, i) Source #

numElements :: Ix i => UArray i Word16 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word16)] -> UArray i Word16 Source #

unsafeAt :: Ix i => UArray i Word16 -> Int -> Word16 Source #

unsafeReplace :: Ix i => UArray i Word16 -> [(Int, Word16)] -> UArray i Word16 Source #

unsafeAccum :: Ix i => (Word16 -> e' -> Word16) -> UArray i Word16 -> [(Int, e')] -> UArray i Word16 Source #

unsafeAccumArray :: Ix i => (Word16 -> e' -> Word16) -> Word16 -> (i, i) -> [(Int, e')] -> UArray i Word16 Source #

IArray UArray Word32 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word32 -> (i, i) Source #

numElements :: Ix i => UArray i Word32 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word32)] -> UArray i Word32 Source #

unsafeAt :: Ix i => UArray i Word32 -> Int -> Word32 Source #

unsafeReplace :: Ix i => UArray i Word32 -> [(Int, Word32)] -> UArray i Word32 Source #

unsafeAccum :: Ix i => (Word32 -> e' -> Word32) -> UArray i Word32 -> [(Int, e')] -> UArray i Word32 Source #

unsafeAccumArray :: Ix i => (Word32 -> e' -> Word32) -> Word32 -> (i, i) -> [(Int, e')] -> UArray i Word32 Source #

IArray UArray Word64 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word64 -> (i, i) Source #

numElements :: Ix i => UArray i Word64 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word64)] -> UArray i Word64 Source #

unsafeAt :: Ix i => UArray i Word64 -> Int -> Word64 Source #

unsafeReplace :: Ix i => UArray i Word64 -> [(Int, Word64)] -> UArray i Word64 Source #

unsafeAccum :: Ix i => (Word64 -> e' -> Word64) -> UArray i Word64 -> [(Int, e')] -> UArray i Word64 Source #

unsafeAccumArray :: Ix i => (Word64 -> e' -> Word64) -> Word64 -> (i, i) -> [(Int, e')] -> UArray i Word64 Source #

IArray UArray Word8 Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word8 -> (i, i) Source #

numElements :: Ix i => UArray i Word8 -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word8)] -> UArray i Word8 Source #

unsafeAt :: Ix i => UArray i Word8 -> Int -> Word8 Source #

unsafeReplace :: Ix i => UArray i Word8 -> [(Int, Word8)] -> UArray i Word8 Source #

unsafeAccum :: Ix i => (Word8 -> e' -> Word8) -> UArray i Word8 -> [(Int, e')] -> UArray i Word8 Source #

unsafeAccumArray :: Ix i => (Word8 -> e' -> Word8) -> Word8 -> (i, i) -> [(Int, e')] -> UArray i Word8 Source #

IArray UArray Bool Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Bool -> (i, i) Source #

numElements :: Ix i => UArray i Bool -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Bool)] -> UArray i Bool Source #

unsafeAt :: Ix i => UArray i Bool -> Int -> Bool Source #

unsafeReplace :: Ix i => UArray i Bool -> [(Int, Bool)] -> UArray i Bool Source #

unsafeAccum :: Ix i => (Bool -> e' -> Bool) -> UArray i Bool -> [(Int, e')] -> UArray i Bool Source #

unsafeAccumArray :: Ix i => (Bool -> e' -> Bool) -> Bool -> (i, i) -> [(Int, e')] -> UArray i Bool Source #

IArray UArray Char Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Char -> (i, i) Source #

numElements :: Ix i => UArray i Char -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Char)] -> UArray i Char Source #

unsafeAt :: Ix i => UArray i Char -> Int -> Char Source #

unsafeReplace :: Ix i => UArray i Char -> [(Int, Char)] -> UArray i Char Source #

unsafeAccum :: Ix i => (Char -> e' -> Char) -> UArray i Char -> [(Int, e')] -> UArray i Char Source #

unsafeAccumArray :: Ix i => (Char -> e' -> Char) -> Char -> (i, i) -> [(Int, e')] -> UArray i Char Source #

IArray UArray Double Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Double -> (i, i) Source #

numElements :: Ix i => UArray i Double -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Double)] -> UArray i Double Source #

unsafeAt :: Ix i => UArray i Double -> Int -> Double Source #

unsafeReplace :: Ix i => UArray i Double -> [(Int, Double)] -> UArray i Double Source #

unsafeAccum :: Ix i => (Double -> e' -> Double) -> UArray i Double -> [(Int, e')] -> UArray i Double Source #

unsafeAccumArray :: Ix i => (Double -> e' -> Double) -> Double -> (i, i) -> [(Int, e')] -> UArray i Double Source #

IArray UArray Float Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Float -> (i, i) Source #

numElements :: Ix i => UArray i Float -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Float)] -> UArray i Float Source #

unsafeAt :: Ix i => UArray i Float -> Int -> Float Source #

unsafeReplace :: Ix i => UArray i Float -> [(Int, Float)] -> UArray i Float Source #

unsafeAccum :: Ix i => (Float -> e' -> Float) -> UArray i Float -> [(Int, e')] -> UArray i Float Source #

unsafeAccumArray :: Ix i => (Float -> e' -> Float) -> Float -> (i, i) -> [(Int, e')] -> UArray i Float Source #

IArray UArray Int Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Int -> (i, i) Source #

numElements :: Ix i => UArray i Int -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Int)] -> UArray i Int Source #

unsafeAt :: Ix i => UArray i Int -> Int -> Int Source #

unsafeReplace :: Ix i => UArray i Int -> [(Int, Int)] -> UArray i Int Source #

unsafeAccum :: Ix i => (Int -> e' -> Int) -> UArray i Int -> [(Int, e')] -> UArray i Int Source #

unsafeAccumArray :: Ix i => (Int -> e' -> Int) -> Int -> (i, i) -> [(Int, e')] -> UArray i Int Source #

IArray UArray Word Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i Word -> (i, i) Source #

numElements :: Ix i => UArray i Word -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Word)] -> UArray i Word Source #

unsafeAt :: Ix i => UArray i Word -> Int -> Word Source #

unsafeReplace :: Ix i => UArray i Word -> [(Int, Word)] -> UArray i Word Source #

unsafeAccum :: Ix i => (Word -> e' -> Word) -> UArray i Word -> [(Int, e')] -> UArray i Word Source #

unsafeAccumArray :: Ix i => (Word -> e' -> Word) -> Word -> (i, i) -> [(Int, e')] -> UArray i Word Source #

IArray UArray (FunPtr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (FunPtr a) -> (i, i) Source #

numElements :: Ix i => UArray i (FunPtr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, FunPtr a)] -> UArray i (FunPtr a) Source #

unsafeAt :: Ix i => UArray i (FunPtr a) -> Int -> FunPtr a Source #

unsafeReplace :: Ix i => UArray i (FunPtr a) -> [(Int, FunPtr a)] -> UArray i (FunPtr a) Source #

unsafeAccum :: Ix i => (FunPtr a -> e' -> FunPtr a) -> UArray i (FunPtr a) -> [(Int, e')] -> UArray i (FunPtr a) Source #

unsafeAccumArray :: Ix i => (FunPtr a -> e' -> FunPtr a) -> FunPtr a -> (i, i) -> [(Int, e')] -> UArray i (FunPtr a) Source #

IArray UArray (Ptr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (Ptr a) -> (i, i) Source #

numElements :: Ix i => UArray i (Ptr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, Ptr a)] -> UArray i (Ptr a) Source #

unsafeAt :: Ix i => UArray i (Ptr a) -> Int -> Ptr a Source #

unsafeReplace :: Ix i => UArray i (Ptr a) -> [(Int, Ptr a)] -> UArray i (Ptr a) Source #

unsafeAccum :: Ix i => (Ptr a -> e' -> Ptr a) -> UArray i (Ptr a) -> [(Int, e')] -> UArray i (Ptr a) Source #

unsafeAccumArray :: Ix i => (Ptr a -> e' -> Ptr a) -> Ptr a -> (i, i) -> [(Int, e')] -> UArray i (Ptr a) Source #

IArray UArray (StablePtr a) Source # 
Instance details

Defined in Data.Array.Base

Methods

bounds :: Ix i => UArray i (StablePtr a) -> (i, i) Source #

numElements :: Ix i => UArray i (StablePtr a) -> Int Source #

unsafeArray :: Ix i => (i, i) -> [(Int, StablePtr a)] -> UArray i (StablePtr a) Source #

unsafeAt :: Ix i => UArray i (StablePtr a) -> Int -> StablePtr a Source #

unsafeReplace :: Ix i => UArray i (StablePtr a) -> [(Int, StablePtr a)] -> UArray i (StablePtr a) Source #

unsafeAccum :: Ix i => (StablePtr a -> e' -> StablePtr a) -> UArray i (StablePtr a) -> [(Int, e')] -> UArray i (StablePtr a) Source #

unsafeAccumArray :: Ix i => (StablePtr a -> e' -> StablePtr a) -> StablePtr a -> (i, i) -> [(Int, e')] -> UArray i (StablePtr a) Source #

(Ix ix, Read ix, Read e, IArray UArray e) => Read (UArray ix e) Source # 
Instance details

Defined in Data.Array.Base

(Ix ix, Show ix, Show e, IArray UArray e) => Show (UArray ix e) Source # 
Instance details

Defined in Data.Array.Base

Methods

showsPrec :: Int -> UArray ix e -> ShowS Source #

show :: UArray ix e -> String Source #

showList :: [UArray ix e] -> ShowS Source #

(Ix ix, Eq e, IArray UArray e) => Eq (UArray ix e) Source # 
Instance details

Defined in Data.Array.Base

Methods

(==) :: UArray ix e -> UArray ix e -> Bool #

(/=) :: UArray ix e -> UArray ix e -> Bool #

(Ix ix, Ord e, IArray UArray e) => Ord (UArray ix e) Source # 
Instance details

Defined in Data.Array.Base

Methods

compare :: UArray ix e -> UArray ix e -> Ordering #

(<) :: UArray ix e -> UArray ix e -> Bool #

(<=) :: UArray ix e -> UArray ix e -> Bool #

(>) :: UArray ix e -> UArray ix e -> Bool #

(>=) :: UArray ix e -> UArray ix e -> Bool #

max :: UArray ix e -> UArray ix e -> UArray ix e #

min :: UArray ix e -> UArray ix e -> UArray ix e #

unsafeArrayUArray :: (MArray (STUArray s) e (ST s), Ix i) => (i, i) -> [(Int, e)] -> e -> ST s (UArray i e) Source #

unsafeReplaceUArray :: (MArray (STUArray s) e (ST s), Ix i) => UArray i e -> [(Int, e)] -> ST s (UArray i e) Source #

unsafeAccumUArray :: (MArray (STUArray s) e (ST s), Ix i) => (e -> e' -> e) -> UArray i e -> [(Int, e')] -> ST s (UArray i e) Source #

unsafeAccumArrayUArray :: (MArray (STUArray s) e (ST s), Ix i) => (e -> e' -> e) -> e -> (i, i) -> [(Int, e')] -> ST s (UArray i e) Source #

eqUArray :: (IArray UArray e, Ix i, Eq e) => UArray i e -> UArray i e -> Bool Source #

cmpUArray :: (IArray UArray e, Ix i, Ord e) => UArray i e -> UArray i e -> Ordering Source #

showsIArray :: (IArray a e, Ix i, Show i, Show e) => Int -> a i e -> ShowS Source #

readIArray :: (IArray a e, Ix i, Read i, Read e) => ReadPrec (a i e) Source #

class Monad m => MArray a e m where 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.

Minimal complete definition

getBounds, getNumElements, unsafeRead, unsafeWrite

Methods

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

Returns the bounds of the array (lowest,highest)

getNumElements :: Ix i => a i e -> m Int Source #

Returns the number of elements in the array

newArray :: 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_ :: 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.

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

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

unsafeRead :: Ix i => a i e -> Int -> m e Source #

unsafeWrite :: Ix i => a i e -> Int -> e -> m () Source #

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 #

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.

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

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

Modify an element in a mutable array

@since FIXME

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

Modify an element in a mutable array. Strict in the written element.

@since FIXME

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.

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.

data STUArray s i e Source #

A mutable array with unboxed elements, that can be manipulated in the ST monad. The type arguments are as follows:

  • s: the state variable argument for the ST type
  • i: the index type of the array (should be an instance of Ix)
  • e: the element type of the array. Only certain element types are supported.

An STUArray will generally be more efficient (in terms of both time and space) than the equivalent boxed version (STArray) with the same element type. However, STUArray is strict in its elements - so don't use STUArray if you require the non-strictness that STArray provides.

Constructors

STUArray !i !i !Int (MutableByteArray# s) 

Instances

Instances details
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 (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 #

Eq (STUArray s i e) Source # 
Instance details

Defined in Data.Array.Base

Methods

(==) :: STUArray s i e -> STUArray s i e -> Bool #

(/=) :: STUArray s i e -> STUArray s i e -> Bool #

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

bOOL_INDEX :: Int# -> Int# Source #

The index of the word which the given Bool array elements falls within.

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.

freezeSTUArray :: STUArray s i e -> ST s (UArray i e) Source #

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

Converts an mutable array into an immutable array. The implementation may either simply cast the array from one type to the other without copying the array, or it may take a full copy of the array.

Note that because the array is possibly not copied, any subsequent modifications made to the mutable version of the array may be shared with the immutable version. It is safe to use, therefore, if the mutable version is never modified after the freeze operation.

The non-copying implementation is supported between certain pairs of array types only; one constraint is that the array types must have identical representations. In GHC, The following pairs of array types have a non-copying O(1) implementation of unsafeFreeze. Because the optimised versions are enabled by specialisations, you will need to compile with optimisation (-O) to get them.

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.

thawSTUArray :: UArray i e -> ST s (STUArray s i e) Source #

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

Converts an immutable array into a mutable array. The implementation may either simply cast the array from one type to the other without copying the array, or it may take a full copy of the array.

Note that because the array is possibly not copied, any subsequent modifications made to the mutable version of the array may be shared with the immutable version. It is only safe to use, therefore, if the immutable array is never referenced again in this thread, and there is no possibility that it can be also referenced in another thread. If you use an unsafeThawwriteunsafeFreeze sequence in a multi-threaded setting, then you must ensure that this sequence is atomic with respect to other threads, or a garbage collector crash may result (because the write may be writing to a frozen array).

The non-copying implementation is supported between certain pairs of array types only; one constraint is that the array types must have identical representations. In GHC, The following pairs of array types have a non-copying O(1) implementation of unsafeThaw. Because the optimised versions are enabled by specialisations, you will need to compile with optimisation (-O) to get them.

thawIOArray :: Array ix e -> IO (IOArray ix e) Source #

freezeIOArray :: IOArray ix e -> IO (Array ix e) Source #

castSTUArray :: STUArray s ix a -> ST s (STUArray s ix b) Source #

Casts an STUArray with one element type into one with a different element type. All the elements of the resulting array are undefined (unless you know what you're doing...).