Haskell Core Libraries (base package)ParentContentsIndex
Data.Array.ST
Portability non-portable
Stability experimental
Maintainer libraries@haskell.org
Contents
Boxed arrays
Unboxed arrays
Overloaded mutable array interface
Description
Mutable boxed and unboxed arrays in the ST monad.
Synopsis
data STArray s i e
data STUArray s i a
castSTUArray :: STUArray s ix a -> ST s (STUArray s ix b)
module Data.Array.MArray
Boxed arrays
data STArray s i e

Mutable, boxed, non-strict arrays 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.

Instances
HasBounds (STArray s)
MArray (STArray s) e (ST s)
(Typeable a, Typeable b, Typeable c) => Typeable (STArray a b c)
Eq (STArray s i e)
Unboxed arrays
data STUArray s i a

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.

Instances
(Typeable a, Typeable b, Typeable c) => Typeable (STUArray a b c)
HasBounds (STUArray s)
MArray (STUArray s) Bool (ST s)
MArray (STUArray s) Char (ST s)
MArray (STUArray s) Int (ST s)
MArray (STUArray s) Word (ST s)
MArray (STUArray s) (Ptr a) (ST s)
MArray (STUArray s) (FunPtr a) (ST s)
MArray (STUArray s) Float (ST s)
MArray (STUArray s) Double (ST s)
MArray (STUArray s) (StablePtr a) (ST s)
MArray (STUArray s) Int8 (ST s)
MArray (STUArray s) Int16 (ST s)
MArray (STUArray s) Int32 (ST s)
MArray (STUArray s) Int64 (ST s)
MArray (STUArray s) Word8 (ST s)
MArray (STUArray s) Word16 (ST s)
MArray (STUArray s) Word32 (ST s)
MArray (STUArray s) Word64 (ST s)
castSTUArray :: STUArray s ix a -> ST s (STUArray s ix b)
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...).
Overloaded mutable array interface
module Data.Array.MArray
Produced by Haddock version 0.3