Module

Data.Incremental.Array

Package
purescript-incremental-functions
Repository
paf31/purescript-incremental-functions

#IArray Source

newtype IArray a

Constructors

Instances

#ArrayChange Source

data ArrayChange a da

Constructors

Instances

#insertAt Source

insertAt :: forall da a. Patch a da => Int -> a -> Change (IArray a)

#deleteAt Source

deleteAt :: forall da a. Patch a da => Int -> Change (IArray a)

#modifyAt Source

modifyAt :: forall da a. Patch a da => Int -> Change a -> Change (IArray a)

#length Source

length :: forall da a. Patch a da => Jet (IArray a) -> Jet (Atomic Int)

Compute the length of the array incrementally.

#map Source

map :: forall db da b a. Patch a da => Patch b db => (Jet a -> Jet b) -> Jet (IArray a) -> Jet (IArray b)

Modify each array element by applying the specified function.

#mapWithIndex Source

mapWithIndex :: forall db b da a. Patch a da => Patch b db => (Jet (Atomic Int) -> Jet a -> Jet b) -> Jet (IArray a) -> Jet (IArray b)

Modify each array element by applying the specified function, taking the index of each element into account.

Note: Insertions or removals in the middle of an array will result in a cascade of modifications to the tail of the result.

#singleton Source

singleton :: forall da a. Patch a da => Jet a -> Jet (IArray a)

Construct an array from a single element.

#static Source

static :: forall da a. Patch a da => Array (Jet a) -> Jet (IArray a)

Construct an array whose elements can change but whose length is fixed, from an array of jets.

#withIndex Source

withIndex :: forall da a. Patch a da => Jet (IArray a) -> Jet (IArray (Tuple (Atomic Int) a))

Annotate an array with the indices of its elements.

Note: Insertions or removals in the middle of an array will result in a cascade of modifications to the tail of the result.