There are two functions for building arrays:
newArray and newArray_. The
former takes an initial value and sets every element of the new
array to this value, whereas the latter leaves all of the elements
of the new array undefined.

The readArray and
writeArray operations allow for reading and
writing to/from the array.

An MArray can be converted into an
IArray (Section 5.17), by
freezing it:

freeze :: (Ix ix, MArray a e m, IArray b e) => a ix e -> m (b ix e)

The IArray returned is independent of the
original MArray, so further modifications to
the mutable version won't affect the frozen one. The usual
implementation of freeze is to make a copy of
the array.

In many cases, the additional copy is unnecessary, for
example when freezing is the last operation on the mutable version
of the array. For these cases, an unsafe version of
freeze is provided which may not
copy[1] the
array:

MArray also provides versions of the
following standard array combinators. Note that they have
slightly different types from the versions in
Array and IArray, mostly to
accomodate the requirement that an MArray must
be used within a monad: