Copyright | (c) The University of Glasgow 2001 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | [email protected] |
Stability | experimental |
Portability | non-portable (uses Data.Array.MArray) |
Safe Haskell | None |
Language | Haskell2010 |
Mutable boxed and unboxed arrays in the ST
monad.
Mutable, boxed, non-strict arrays in the ST
monad. The type arguments are as follows:
s
: the state variable argument for the ST
typei
: the index type of the array (should be an instance of Ix
)e
: the element type of the array.MArray (STArray s) e (ST s) | |
Defined in Data.Array.Base MethodsgetBounds :: Ix i => STArray s i e -> ST s (i, i) Source getNumElements :: Ix i => STArray s i e -> ST s Int 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) unsafeRead :: Ix i => STArray s i e -> Int -> ST s e unsafeWrite :: Ix i => STArray s i e -> Int -> e -> ST s () | |
MArray (STArray s) e (ST s) | |
Defined in Data.Array.Base MethodsgetBounds :: Ix i => STArray s i e -> ST s (i, i) Source getNumElements :: Ix i => STArray s i e -> ST s Int 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) unsafeRead :: Ix i => STArray s i e -> Int -> ST s e unsafeWrite :: Ix i => STArray s i e -> Int -> e -> ST s () | |
Eq (STArray s i e) | Since: base-2.1 |
runSTArray :: (forall s. ST s (STArray s i e)) -> Array i e Source
A safe way to create and work with a mutable array before returning an immutable array for later perusal. This function avoids copying the array before returning it - it uses unsafeFreeze
internally, but this wrapper is a safe interface to that function.
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
typei
: 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.
runSTUArray :: (forall s. ST s (STUArray s i e)) -> UArray i e Source
A safe way to create and work with an unboxed mutable array before returning an immutable array for later perusal. This function avoids copying the array before returning it - it uses unsafeFreeze
internally, but this wrapper is a safe interface to that function.
module Data.Array.MArray
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.8.3/docs/html/libraries/array-0.5.4.0/Data-Array-ST.html