priority-map-0.1.0.0: The priority map data structure is a map combined with a heap

Safe HaskellNone
LanguageHaskell2010

Data.PriorityMap.DynArray

Description

A dynamically resizeable array in the ST monad. Indices begin at 0.

Synopsis

Documentation

data DynArray s e

A dynamically resizeable array in the ST monad.

Constructors

DynArray 

Fields

payload :: STRef s (STArray s Int e)

A mutable reference to the current array that is in use.

growth :: Int -> Int

The growth strategy of the array. When the array is grown, this function takes the old array size and generates the new array size. This function should be monotonically increasing.

empty :: ST s (DynArray s e)

Create a new, empty array, with a current capacity of 16, which doubles in size whenever it exceeds capacity.

emptyWith :: Int -> (Int -> Int) -> ST s (DynArray s e)

Create a new, empty array with a particular size and growth strategy.

(!) :: DynArray s e -> Int -> ST s e

Read from the array at a given index. If the index has not yet been written to, behavior is undefined.

wr :: DynArray s e -> Int -> e -> ST s ()

Write to the array at a given index. The array will automatically grow to allow itself to be written at any (postive-valued) index.

grow :: DynArray s e -> ST s ()

Grow the capacity of the array according to it's growth strategy.