|
Data.ArrayBZ.Dynamic | Portability | Hugs/GHC | Stability | experimental | Maintainer | Bulat Ziganshin <Bulat.Ziganshin@gmail.com> |
|
|
|
|
|
Description |
Arrays with dynamically changed bounds in IO and ST monads.
|
|
Synopsis |
|
|
|
Documentation |
|
Array with dynamically changed bounds can be created from any mutable array
type by using type converter Dynamic. I have created synonyms for widely used
array constructors, for example DynamicIOUArray Int Double.
Dynamic array supports the same MArray and HasMutableBounds interfaces as other
mutable arrays, but they don't support HasBounds interface. Dynamic array can be
resized explicitly by operation resizeDynamicArray.
Dynamic array can also grow automatically when writeArray is used with index
that is out of current array bounds. For this to work, array should be created
using non-standard operations newDynamicArray or newDynamicArray_. The first
argument of these operations is growing strategy, i.e. the function of type
`GrowBoundsF i`, other arguments are the same as for newArray/newArray_. The
predefined growing strategies include noGrow that disables automatic growing,
growMinimally that extends array only to include new index and growTwoTimes
that extend array at least 2 times each time it needs to grow.
When array grows, either explicitly or automatically, new elements are
initialized with init value if this array was created by
newArray/newDynamicArray.
|
|
|
Representation of dynamic array. Includes
* function to calculate new array bounds when it needs to grow
* optional value used for initializing new elements when array grows
* reference to current array contents
| Instances | |
|
|
|
Dynamic arrays in IO monad
|
|
|
Dynamic version of IOArray
|
|
|
Dynamic version of IOUArray
|
|
|
Dynamic arrays in ST monad
|
|
|
Dynamic version of STArray
|
|
|
Dynamic version of STUArray
|
|
type GrowBoundsF i = (i, i) -> i -> (i, i) | Source |
|
This type represents function that calculates new array bounds when it needs to grow
|
|
Operations
|
|
newDynamicArray |
|
newDynamicArray_ |
|
resizeDynamicArray |
|
Array growing strategies
|
|
noGrow |
|
growMinimally |
|
growTwoTimes |
|
module Data.ArrayBZ.Internals.MArray |
|
Produced by Haddock version 2.4.2 |