array

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.
Mutable and immutable arrays In addition to providing the Data.Array module as specified in the Haskell 2010 Language Report, this package also defines the classes IArray of immutable arrays and MArray of arrays mutable within appropriate monads, as well as some instances of these classes.
Constructs an immutable array from a pair of bounds and a list of initial associations. The bounds are specified as a pair of the lowest and highest bounds in the array respectively. For example, a one-origin vector of length 10 has bounds (1,10), and a one-origin 10 by 10 matrix has bounds ((1,1),(10,10)). An association is a pair of the form (i,x), which defines the value of the array at index i to be x. The array is undefined if any index in the list is out of bounds. If any two associations in the list have the same index, the value at that index is implementation-dependent. (In GHC, the last value specified for that index is used. Other implementations will also do this for unboxed arrays, but Haskell 98 requires that for Array the value at such indices is bottom.) Because the indices must be checked for these errors, array is strict in the bounds argument and in the indices of the association list. Whether array is strict or non-strict in the elements depends on the array type: Array is a non-strict array type, but all of the UArray arrays are strict. Thus in a non-strict array, 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. 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.
Construct a new Value from a list of Values.
Convert a list of values to an Array.
Lift an Array decoder to a Value decoder.
Lift an array encoder into a value encoder.
Make an JavaScript array from a list of values
>>> testJSaddle $ eval "['Hello', 'World'][1]"
World

>>> testJSaddle $ array ["Hello", "World"] !! 1
World

>>> testJSaddle $ eval "['Hello', null, undefined, true, 1]"
Hello,,,true,1

>>> testJSaddle $ array ("Hello", JSNull, (), True, 1.0::Double)
Hello,,,true,1
SQL99 array data types
Like tabular but in math mode by default
Unlift an Array to a value Value.
Turn an array builder into final value. The first parameter is OID of the element type.
Create an array from a list of (index, element) pairs.
Parses both empty and non-empty arrays. Should probably be split up into further parts to allow for the separation of [] and [1, 2, 3].
Smart array constructor that only type checks if the length of the given list matches the length of the array at type level.
Construct an array from a shape and a value without any shape validation.
>>> array [2,3] [0..5]
UnsafeArray [2,3] [0,1,2,3,4,5]
Construct an Array, checking shape.
>>> array [0..22] :: Array [2,3,4] Int
*** Exception: Shape Mismatch
...
JSON Array literal from a foldable over element literals.