record Array : Type -> Type An immutable array paired with its size (= number of values).
This is the dependent pair version of `IArray size a`.
Totality: total
Visibility: public export
Constructor: A : (size : Nat) -> IArray size a -> Array a
Projections:
.arr : ({rec:0} : Array a) -> IArray (size {rec:0}) a .size : Array a -> Nat
Hints:
Foldable1 Array Traversable1 Array
.size : Array a -> Nat- Totality: total
Visibility: public export size : Array a -> Nat- Totality: total
Visibility: public export .arr : ({rec:0} : Array a) -> IArray (size {rec:0}) a- Totality: total
Visibility: public export arr : ({rec:0} : Array a) -> IArray (size {rec:0}) a- Totality: total
Visibility: public export ix : IArray n a -> (0 m : Nat) -> Ix (S m) n => a Safely access a value in an immutable array at position `n - m`.
Totality: total
Visibility: exportatNat : IArray n a -> (m : Nat) -> {auto 0 _ : LT m n} -> a Safely access a value in an array at the given position.
Totality: total
Visibility: exportempty : IArray 0 a The empty array.
Totality: total
Visibility: exportarrayL : (ls : List a) -> IArray (length ls) a Copy the values in a list to an immutable array of the same length.
Totality: total
Visibility: exportarray : Vect n a -> IArray n a Copy the values in a vector to an immutable array of the same length.
Totality: total
Visibility: exportrevArray : Vect n a -> IArray n a Copy the values in a vector to an immutable array of the same length
in reverse order.
This is useful if the values in the array have been collected
from tail to head for instance when parsing some data.
Totality: total
Visibility: exportfill : (n : Nat) -> a -> IArray n a Fill an immutable array of the given size with the given value.
Totality: total
Visibility: exportgenerate : (n : Nat) -> (Fin n -> a) -> IArray n a Generate an immutable array of the given size using
the given iteration function.
Totality: total
Visibility: exportiterate : (n : Nat) -> (a -> a) -> a -> IArray n a Generate an immutable array of the given size by filling it with the
results of repeatedly applying `f` to the initial value.
Totality: total
Visibility: exportforce : IArray n a -> IArray n a Copy the content of an array to a new immutable array.
This is mainly useful for reducing memory consumption, in case the
original array is actually backed by a much larger array, for
instance after taking a smaller prefix of a large array with `take`.
Totality: total
Visibility: exportfromPairs : (n : Nat) -> a -> List (Nat, a) -> IArray n a Allocate an immutable array, fill it with the given default value, and use a list
of pairs to replace specific positions.
Totality: total
Visibility: exportfromFinPairs : (n : Nat) -> a -> List (Fin n, a) -> IArray n a Like `fromPairs` but with `Fin n` as indices.
Totality: total
Visibility: exportunsafeJSArrayOf1 : (0 a : Type) -> AnyPtr -> F1 s (Array a) Wraps a pointer to a mutable JS array in an immutable array
by copying the values first.
Use this for wrapping arrays that can still be mutated in JS land, or if
you are uncertain about whether the pointer points to a mutable array or
not. The array will first be copied before being wrapped in an `Array a`.
Totality: total
Visibility: exportunsafeJSArrayOf : HasIO io => (0 a : Type) -> AnyPtr -> io (Array a) Like `unsafeJSArrayOf1` but runs in an `IO` monad.
Totality: total
Visibility: exportunsafeWrapJSArray : (0 a : Type) -> AnyPtr -> Array a Like `unsafeJSArrayOf1` but wraps the pointer without copying
it first.
Use this only if the pointer points to an array that cannot be
inadvertently mutated later on.
Totality: total
Visibility: exporthcomp : Ord a => IArray m a -> IArray n a -> Ordering Lexicographic comparison of immutable arrays of distinct length.
Totality: total
Visibility: exportheq : Eq a => IArray m a -> IArray n a -> Bool Heterogeneous equality for immutable arrays.
Totality: total
Visibility: exporttoVect : IArray n a -> Vect n a Convert an immutable array to a vector of the same length.
Totality: total
Visibility: exporttoVectWithIndex : IArray n a -> Vect n (Fin n, a) Convert an immutable array to a vector of the same length
pairing all values with their index.
Totality: total
Visibility: exportfoldrKV : (Fin n -> e -> a -> a) -> a -> IArray n e -> a Right fold over the values of an immutable array plus their indices.
Totality: total
Visibility: exportfoldlKV : (Fin n -> a -> e -> a) -> a -> IArray n e -> a Left fold over the values of an immutable array plus their indices.
Totality: total
Visibility: exportmapWithIndex : (Fin n -> a -> b) -> IArray n a -> IArray n b Mapping over the values of an immutable array together with their indices.
Totality: total
Visibility: exportupdateAt : Fin n -> (a -> a) -> IArray n a -> IArray n a Update a single position in an immutable array by applying the given
function.
This will have to copy the whole array, so it runs in O(n).
Totality: total
Visibility: exportsetAt : Fin n -> a -> IArray n a -> IArray n a Set a single position in an immutable array.
This will have to copy the whole array, so it runs in O(n).
Totality: total
Visibility: exporttraverseWithIndex : Applicative f => (Fin n -> a -> f b) -> IArray n a -> f (IArray n b) Effectful traversal of the values in an immutable array together with
their corresponding indices.
Totality: total
Visibility: exportdrop : (m : Nat) -> IArray n a -> IArray (minus n m) a Drop n elements from a immutable array. O(n)
Totality: total
Visibility: exportfilterWithKey : (Fin n -> a -> Bool) -> IArray n a -> Array a Filter the values in an immutable array together with their corresponding
indices according to the given predicate.
Totality: total
Visibility: exportfilter : (a -> Bool) -> IArray n a -> Array a Filters the values in an immutable array according to the given predicate.
Totality: total
Visibility: exportmapMaybeWithKey : (Fin n -> a -> Maybe b) -> IArray n a -> Array b Map the values in an immutable array together with their corresponding indices
over a function that might not return a result for all values.
Totality: total
Visibility: exportmapMaybe : (a -> Maybe b) -> IArray n a -> Array b Map the values in an immutable array together with their corresponding indices
over a function that might not return a result for all values.
Totality: total
Visibility: exportSnocSize : SnocList (Array a) -> Nat Size of an array after concatenating a SnocList of arrays.
It is easier to implement this and keep the indices correct,
therefore, this is the default for concatenating arrays.
Totality: total
Visibility: public exportListSize : List (Array a) -> Nat Size of an immutable array after concatenating a List of arrays.
Totality: total
Visibility: public exportsnocConcat : (sa : SnocList (Array a)) -> IArray (SnocSize sa) a Concatenate a SnocList of arrays.
This allocates a large enough array in advance, and therefore runs in
O(SnocSize sa).
Totality: total
Visibility: exportlistConcat : (as : List (Array a)) -> IArray (ListSize as) a Concatenate a List of arrays.
This allocates a large enough array in advance, and therefore runs in
O(ListSize as).
Totality: total
Visibility: exportappend : IArray m a -> IArray n a -> IArray (m + n) a Concatenate two immutable arrays in O(m+n) runtime.
Totality: total
Visibility: exporttraverseKV1_ : (Fin n -> a -> F1' q) -> IArray n a -> F1' q Runs a linear effect over the values plus their indices in an array.
Totality: total
Visibility: export