Module

Solid.Utility

Package
purescript-purs-solid
Repository
arazorda/purs-solid

Reactive list mapping. Results are reused as the list changes; each item gets its own owner, disposed when the item leaves the list.

#mapArray Source

mapArray :: forall f a b. Tracked f => StableIdentity a => f (Array a) -> (a -> Accessor Int -> Setup b) -> Setup (f (Array b))

Keyed by the items themselves: an item keeps its result while it stays in the list, and only its index changes. For primitives and store cursors.

#mapArrayByReference Source

mapArrayByReference :: forall f a b. Tracked f => f (Array a) -> (a -> Accessor Int -> Setup b) -> Setup (f (Array b))

mapArray for any values, keyed by reference (===). Results survive only while the list keeps the same values.

#mapArrayUnkeyed Source

mapArrayUnkeyed :: forall f a b. Tracked f => f (Array a) -> (Accessor a -> Int -> Setup b) -> Setup (f (Array b))

Keyed by position: the result at index i stays, and its item accessor updates when a different value lands there.

#mapArrayBy Source

mapArrayBy :: forall f a b k. Tracked f => (a -> k) -> f (Array a) -> (Accessor a -> Accessor Int -> Setup b) -> Setup (f (Array b))

Keyed by a derived key: items with the same key share a result, whose item accessor updates to the newest value.

#repeat Source

repeat :: forall f b. Tracked f => f Int -> (Int -> Setup b) -> Setup (f (Array b))

Maps the indices 0 .. count - 1; results are reused as count changes.

#repeatFrom Source

repeatFrom :: forall f b. Tracked f => f Int -> f Int -> (Int -> Setup b) -> Setup (f (Array b))

Maps the indices from .. from + count - 1, e.g. a virtualized window; results are reused as the window moves.

Re-exports from Solid.Internal.Identity

#StableIdentity Source

class StableIdentity a 

Values that stay === when a list is recomputed, so a list keyed by its items keeps each row: primitives and store cursors.

Instances