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 a da. Patch a da => Int -> a -> Change (IArray a)

#deleteAt Source

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

#modifyAt Source

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

#length Source

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

Compute the length of the array incrementally.

#map Source

map :: forall a b da db. 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 a da b db. 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 a da. Patch a da => Jet a -> Jet (IArray a)

Construct an array from a single element.

#static Source

static :: forall a da. 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 a da. 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.