-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | low-level unboxed arrays, with minimal features. -- -- This package includes low-level, portable uboxed array types. The -- SmallArray has been tuned for size in memory, and hence does not -- support many of the nice operations supplied by other array libraries @package smallarray @version 0.2.0 module Data.SmallArray.Unsafe class Elt e unsafeIndex :: Elt e => Array e -> Int -> e unsafeRead :: Elt e => MArray s e -> Int -> ST s e unsafeWrite :: Elt e => MArray s e -> Int -> e -> ST s () -- | Create a new array. The contents are not initialized in any way, and -- may be invalid. unsafeNew :: Elt e => Int -> ST s (MArray s e) unsafeFreeze :: MArray s e -> ST s (Array e) -- | Unsafely copy the elements of an array. Array bounds are not checked. unsafeCopy :: Elt e => MArray s e -> Int -> MArray s e -> Int -> Int -> ST s () -- | 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 Data.Array -- family of modules, but are shorter due to the assumption of qualifid -- naming. module Data.SmallArray -- | A simple array. Indexing starts from zero. data Array a -- | A simple mutable array. Indexing starts from zero. data MArray s a class IArray a length :: IArray a => a -> Int class Elt e index :: Elt e => Array e -> Int -> e read :: Elt e => MArray s e -> Int -> ST s e write :: Elt e => MArray s e -> Int -> e -> ST s () -- | The empty array empty :: Elt e => Array e -- | Create a new array with the specified default value. new :: Elt e => Int -> e -> ST s (MArray s e) -- | Execute an action creating a mutable array, and return the resulting -- equivalent pure array. No copy is performed. run :: (forall s. ST s (MArray s e)) -> Array e run' :: (forall s. ST s (MArray s e, a)) -> (Array e, a) -- | Create an array from a list. fromList :: Elt e => [e] -> Array e -- | Copy an array in its entirety. The destination array must be at least -- as big as the source. copy :: Elt e => MArray s e -> MArray s e -> ST s () -- | Output the array to a list. toList :: Elt e => Array e -> [e]