array package:base

Construct an array with the specified bounds and containing values for given indices within these bounds. The array is undefined (i.e. bottom) if any index in the list is out of bounds. The Haskell 2010 Report further specifies that if any two associations in the list have the same index, the value at that index is undefined (i.e. bottom). However in GHC's implementation, the value at such an index is the value part of the last association with that index in the list. Because the indices must be checked for these errors, array is strict in the bounds argument and in the indices of the association list, but non-strict in the values. Thus, recurrences such as the following are possible:
a = array (1,100) ((1,1) : [(i, i * a!(i-1)) | i <- [2..100]])
Not every index within the bounds of the array need appear in the association list, but the values associated with indices that do not appear will be undefined (i.e. bottom). If, in any dimension, the lower bound is greater than the upper bound, then the array is legal, but empty. Indexing an empty array always gives an array-bounds error, but bounds still yields the bounds with which the array was constructed.
Marshalling support: routines allocating, storing, and retrieving Haskell lists that are represented as arrays in the foreign language
The type of immutable non-strict (boxed) arrays with indices in i and elements in e.
Exceptions generated by array operations
Legacy interface for arrays of arrays. Deprecated, because the Array# type can now store arrays directly. Consider simply using Array# instead of ArrayArray#. Use GHC.Exts instead of importing this module directly.
Lifted wrapper for ByteArray#. Since ByteArray# is an unlifted type and not a member of kind Type, things like [ByteArray#] or IO ByteArray# are ill-typed. To work around this inconvenience this module provides a standard lifted wrapper, inhabiting Type. Clients are expected to use ByteArray in higher-level APIs, but wrap and unwrap ByteArray internally as they please and use functions from GHC.Exts. The memory representation of a ByteArray is:
╭─────────────┬───╮  ╭────────┬──────┬─────────╮
│ Constructor │ * ┼─►│ Header │ Size │ Payload │
╰─────────────┴───╯  ╰────────┴──────┴─────────╯
And its overhead is the following: Where a word is the unit of heap allocation, measuring 8 bytes on 64-bit systems, and 4 bytes on 32-bit systems.
Lifted wrapper for MutableByteArray#. Since MutableByteArray# is an unlifted type and not a member of kind Type, things like [MutableByteArray#] or IO MutableByteArray# are ill-typed. To work around this inconvenience this module provides a standard lifted wrapper, inhabiting Type. Clients are expected to use MutableByteArray in higher-level APIs, but wrap and unwrap MutableByteArray internally as they please and use functions from GHC.Exts.
This function is similar to mallocArray, but yields a memory area that has a finalizer attached that releases the memory area. As with mallocForeignPtr, it is not guaranteed that the block of memory was allocated by malloc.
This function is similar to mallocArray0, but yields a memory area that has a finalizer attached that releases the memory area. As with mallocForeignPtr, it is not guaranteed that the block of memory was allocated by malloc.
Temporarily allocate space for the given number of elements (like alloca, but for multiple elements).
Like allocaArray, but add an extra position to hold a special termination element.
Like mallocArray, but allocated memory is filled with bytes of value zero.
Like callocArray0, but allocated memory is filled with bytes of value zero.
Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may not overlap
Return the number of elements in an array, excluding the terminator
Allocate storage for the given number of elements of a storable type (like malloc, but for multiple elements).
Like mallocArray, but add an extra position to hold a special termination element.
Copy the given number of elements from the second array (source) into the first array (destination); the copied areas may overlap
Write a list of storable elements into a newly allocated, consecutive sequence of storable values (like new, but for multiple elements).