|
Data.Array.Vanilla.Unsafe |
|
|
Description |
Two flavours of array: mutable and immutable. All are boxed,
lazy, and use zero-origin integers as indicies.
|
|
Synopsis |
|
|
|
Documentation |
|
|
The type of immutable arrays, with elements of type x.
|
|
|
|
The type of mutable arrays, with elements of type x.
These arrays live in the ST monad, but you can use
stToIO to convert this to IO if required.
Two MArrays are equal as per (==) if they are both
the exact same array (i.e., the same block of RAM).
Two seperate arrays which merely hold the same data are
not considered equal. (This fact could change at any
second, after all.)
| Instances | |
|
|
|
Create a brand new MArray, of the specified size, with
all elements set to the value provided. If the array
size is n, valid indicies are from 0 to n-1.
|
|
|
Read from an MArray.
Unsafe: No bounds checks. Indicies below 0 or
above n-1 will likely result in a program crash.
|
|
|
Write to an MArray, replacing the element at the
specified index.
Unsafe: No bounds checks. Indicies below 0 or
above n-1 will likely result in a program crash
(if you're lucky), or weird data corruption
(if you're unlucky).
|
|
|
Create a new IArray which refers to the same memory
block as an existing MArray.
Unsafe: Mutating the MArray will cause the contents
of the IArray to mutate also, violating referential
transparency. (Avoid this by explicitly copying the data
before freezing.)
|
|
|
Create a new MArray which refers to the same memory
block as an existing IArray.
Unsafe: Mutating the MArray will cause the contents
of the IArray to mutate also, violating referential
transparency. (Avoid this by explicitly copying the data
after thawing and before mutating it.)
|
|
|
Read from an IArray. (Since IArrays are immutable,
this is a pure operation.)
Unsafe: No bounds checks. Indicies below 0 or
above n-1 will likely result in a program crash.
|
|
Produced by Haddock version 2.4.2 |