Idris2Doc : Data.Array.Indexed

Data.Array.Indexed

(source)

Definitions

recordArray : 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) ->IArraysizea->Arraya

Projections:
.arr : ({rec:0} : Arraya) ->IArray (size{rec:0}) a
.size : Arraya->Nat

Hints:
Foldable1Array
Traversable1Array
.size : Arraya->Nat
Totality: total
Visibility: public export
size : Arraya->Nat
Totality: total
Visibility: public export
.arr : ({rec:0} : Arraya) ->IArray (size{rec:0}) a
Totality: total
Visibility: public export
arr : ({rec:0} : Arraya) ->IArray (size{rec:0}) a
Totality: total
Visibility: public export
ix : IArrayna-> (0m : Nat) ->Ix (Sm) n=>a
  Safely access a value in an immutable array at position `n - m`.

Totality: total
Visibility: export
atNat : IArrayna-> (m : Nat) -> {auto0_ : LTmn} ->a
  Safely access a value in an array at the given position.

Totality: total
Visibility: export
empty : IArray0a
  The empty array.

Totality: total
Visibility: export
arrayL : (ls : Lista) ->IArray (lengthls) a
  Copy the values in a list to an immutable array of the same length.

Totality: total
Visibility: export
array : Vectna->IArrayna
  Copy the values in a vector to an immutable array of the same length.

Totality: total
Visibility: export
revArray : Vectna->IArrayna
  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: export
fill : (n : Nat) ->a->IArrayna
  Fill an immutable array of the given size with the given value.

Totality: total
Visibility: export
generate : (n : Nat) -> (Finn->a) ->IArrayna
  Generate an immutable array of the given size using
the given iteration function.

Totality: total
Visibility: export
iterate : (n : Nat) -> (a->a) ->a->IArrayna
  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: export
force : IArrayna->IArrayna
  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: export
fromPairs : (n : Nat) ->a->List (Nat, a) ->IArrayna
  Allocate an immutable array, fill it with the given default value, and use a list
of pairs to replace specific positions.

Totality: total
Visibility: export
fromFinPairs : (n : Nat) ->a->List (Finn, a) ->IArrayna
  Like `fromPairs` but with `Fin n` as indices.

Totality: total
Visibility: export
unsafeJSArrayOf1 : (0a : Type) ->AnyPtr->F1s (Arraya)
  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: export
unsafeJSArrayOf : HasIOio=> (0a : Type) ->AnyPtr->io (Arraya)
  Like `unsafeJSArrayOf1` but runs in an `IO` monad.

Totality: total
Visibility: export
unsafeWrapJSArray : (0a : Type) ->AnyPtr->Arraya
  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: export
hcomp : Orda=>IArrayma->IArrayna->Ordering
  Lexicographic comparison of immutable arrays of distinct length.

Totality: total
Visibility: export
heq : Eqa=>IArrayma->IArrayna->Bool
  Heterogeneous equality for immutable arrays.

Totality: total
Visibility: export
toVect : IArrayna->Vectna
  Convert an immutable array to a vector of the same length.

Totality: total
Visibility: export
toVectWithIndex : IArrayna->Vectn (Finn, a)
  Convert an immutable array to a vector of the same length
pairing all values with their index.

Totality: total
Visibility: export
foldrKV : (Finn->e->a->a) ->a->IArrayne->a
  Right fold over the values of an immutable array plus their indices.

Totality: total
Visibility: export
foldlKV : (Finn->a->e->a) ->a->IArrayne->a
  Left fold over the values of an immutable array plus their indices.

Totality: total
Visibility: export
mapWithIndex : (Finn->a->b) ->IArrayna->IArraynb
  Mapping over the values of an immutable array together with their indices.

Totality: total
Visibility: export
updateAt : Finn-> (a->a) ->IArrayna->IArrayna
  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: export
setAt : Finn->a->IArrayna->IArrayna
  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: export
traverseWithIndex : Applicativef=> (Finn->a->fb) ->IArrayna->f (IArraynb)
  Effectful traversal of the values in an immutable array together with
their corresponding indices.

Totality: total
Visibility: export
drop : (m : Nat) ->IArrayna->IArray (minusnm) a
  Drop n elements from a immutable array. O(n)

Totality: total
Visibility: export
filterWithKey : (Finn->a->Bool) ->IArrayna->Arraya
  Filter the values in an immutable array together with their corresponding
indices according to the given predicate.

Totality: total
Visibility: export
filter : (a->Bool) ->IArrayna->Arraya
  Filters the values in an immutable array according to the given predicate.

Totality: total
Visibility: export
mapMaybeWithKey : (Finn->a->Maybeb) ->IArrayna->Arrayb
  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: export
mapMaybe : (a->Maybeb) ->IArrayna->Arrayb
  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: export
SnocSize : SnocList (Arraya) ->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 export
ListSize : List (Arraya) ->Nat
  Size of an immutable array after concatenating a List of arrays.

Totality: total
Visibility: public export
snocConcat : (sa : SnocList (Arraya)) ->IArray (SnocSizesa) a
  Concatenate a SnocList of arrays.

This allocates a large enough array in advance, and therefore runs in
O(SnocSize sa).

Totality: total
Visibility: export
listConcat : (as : List (Arraya)) ->IArray (ListSizeas) a
  Concatenate a List of arrays.

This allocates a large enough array in advance, and therefore runs in
O(ListSize as).

Totality: total
Visibility: export
append : IArrayma->IArrayna->IArray (m+n) a
  Concatenate two immutable arrays in O(m+n) runtime.

Totality: total
Visibility: export
traverseKV1_ : (Finn->a->F1'q) ->IArrayna->F1'q
  Runs a linear effect over the values plus their indices in an array.

Totality: total
Visibility: export