MArray

Mutable array type, for use in the ST monad.
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.
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.
Mutable version of a Manifest Array. The extra type argument s is for the state token used by IO and ST.
Mutable Array of a
The accumArray function deals with repeated indices in the association list using an accumulating function which combines the values of associations 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]
accumArray is strict in each result of applying the accumulating function, although it is lazy in the initial value. Thus, unlike arrays built with array, accumulated arrays should not in general be recursive.
Create a sequence consisting of the elements of an Array. Note that the resulting sequence elements may be evaluated lazily (as on GHC), so you must force the entire structure to be sure that the original array can be garbage-collected.
A constructor will be encoded to a 2-element array where the first element is the tag of the constructor (modified by the constructorTagModifier) and the second element the encoded contents of the constructor.
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]
Strict accumulating left-associative fold.
Strict accumulating left-associative monadic fold.
Strict accumulating right-associative fold.
Strict accumulating right-associative monadic fold.
forMArrayM_ is mapMArrayM_ with its arguments flipped.
Map elements to monadic actions, sequence them left-to-right, and discard the results.