unordered-containers-0.2.1.0: Efficient hashing-based container types

Safe HaskellSafe-Infered

Data.HashMap.Array

Contents

Description

Zero based arrays.

Note that no bounds checking are performed.

Synopsis

Documentation

data Array a Source

Instances

Show a => Show (Array a) 
NFData a => NFData (Array a) 

data MArray s a Source

Creation

new :: Int -> a -> ST s (MArray s a)Source

Create a new mutable array of specified size, in the specified state thread, with each element containing the specified initial value.

new_ :: Int -> ST s (MArray s a)Source

singleton' :: a -> ST s (Array a)Source

pair :: a -> a -> Array aSource

Basic interface

read :: MArray s a -> Int -> ST s aSource

write :: MArray s a -> Int -> a -> ST s ()Source

index :: Array a -> Int -> aSource

index_ :: Array a -> Int -> ST s aSource

indexM_ :: MArray s a -> Int -> ST s aSource

update :: Array e -> Int -> e -> Array eSource

O(n) Update the element at the given position in this array.

update' :: Array e -> Int -> e -> ST s (Array e)Source

O(n) Update the element at the given position in this array.

updateWith :: Array e -> Int -> (e -> e) -> Array eSource

O(n) Update the element at the given positio in this array, by applying a function to it. Evaluates the element to WHNF before inserting it into the array.

unsafeUpdate' :: Array e -> Int -> e -> ST s ()Source

O(1) Update the element at the given position in this array, without copying.

insert :: Array e -> Int -> e -> Array eSource

O(n) Insert an element at the given position in this array, increasing its size by one.

insert' :: Array e -> Int -> e -> ST s (Array e)Source

O(n) Insert an element at the given position in this array, increasing its size by one.

delete :: Array e -> Int -> Array eSource

O(n) Delete an element at the given position in this array, decreasing its size by one.

delete' :: Array e -> Int -> ST s (Array e)Source

O(n) Delete an element at the given position in this array, decreasing its size by one.

run :: (forall s. ST s (MArray s e)) -> Array eSource

run2 :: (forall s. ST s (MArray s e, a)) -> (Array e, a)Source

copy :: Array e -> Int -> MArray s e -> Int -> Int -> ST s ()Source

Unsafely copy the elements of an array. Array bounds are not checked.

copyM :: MArray s e -> Int -> MArray s e -> Int -> Int -> ST s ()Source

Unsafely copy the elements of an array. Array bounds are not checked.

Folds

foldl' :: (b -> a -> b) -> b -> Array a -> bSource

foldr :: (a -> b -> b) -> b -> Array a -> bSource

thaw :: Array e -> Int -> Int -> ST s (MArray s e)Source

map :: (a -> b) -> Array a -> Array bSource

map' :: (a -> b) -> Array a -> Array bSource

Strict version of map.

traverse :: Applicative f => (a -> f b) -> Array a -> f (Array b)Source

filter :: (a -> Bool) -> Array a -> Array aSource