Portability | portable |
---|---|
Stability | experimental |
Maintainer | aslatter@gmail.com |
Safe Haskell | Safe-Infered |
Packed, unboxed, heap-resident arrays. Suitable for performance critical use, both in terms of large data quantities and high speed.
This module is intended to be imported qualified
, to avoid name
clashes with Prelude functions, e.g.
import qualified Data.SmallArray as A
The names in this module resemble those in the Array
family
of modules, but are shorter due to the assumption of qualifid
naming.
- data Array a
- data MArray s a
- class IArray a where
- class Elt e where
- empty :: Elt e => Array e
- new :: Elt e => Int -> e -> ST s (MArray s e)
- run :: (forall s. ST s (MArray s e)) -> Array e
- run' :: (forall s. ST s (MArray s e, a)) -> (Array e, a)
- fromList :: Elt e => [e] -> Array e
- copy :: Elt e => MArray s e -> MArray s e -> ST s ()
- toList :: Elt e => Array e -> [e]
Array types
A simple array. Indexing starts from zero.
A simple mutable array. Indexing starts from zero.
index :: Array e -> Int -> eSource
Retrieve an element in an array at the specified location. Array indices start at zero.
read :: MArray s e -> Int -> ST s eSource
Retrieve an element from a mutable array at the specified location. Array indices start at zero.
write :: MArray s e -> Int -> e -> ST s ()Source
Write an element to a mutable array at the specified location. Array indices start at zero.
Creation
new :: Elt e => Int -> e -> ST s (MArray s e)Source
Create a new array with the specified default value.
run :: (forall s. ST s (MArray s e)) -> Array eSource
Execute an action creating a mutable array, and return the resulting equivalent pure array. No copy is performed.
Copy an array in its entirety. The destination array must be at least as big as the source.