package reactiveData
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=b98746d36df24d82d31a94cce3ff590e332b6ad62ebe86f6e53a0cf965849fba
sha512=4b996caf01819d34acd0564f9410ae1a6def818f7b5ab2777e0daf16799bbd0c9582a7ca5218f5cbd71db7645aca4cf95e4d5c9010a3b4514c8bd4ac10f38b56
doc/reactiveData/ReactiveData/RMap/index.html
Module ReactiveData.RMap
Source
Reactive map data structure
Parameters
Signature
include S with type 'a data = 'a M.t and type 'a patch := 'a patch
Reactive version of the data container
Message format
Handle that permits applying incremental updates
Build a container from initial contents. The handle can be used for performing reactive updates.
from_event d e
is a container whose initial value is d
, and which gets updated for every occurrence of e
Convert a React signal into a ReactiveData container.
Whenever the signal changes from value v
to value v'
, we detect the differences between v
and v'
, and perform downstream computation (e.g., for map
) only on the new and modified elements.
patch h p
applies p
on the container corresponding to h
set h d
sets the contents of the container corresponding to h
, disregarding previous contents
map f c
applies f
on all elements of c
, producing a new reactive container c'
. Modifying the contents of c
leads to modifications of c'
. f
is applied only on the new or modified elements of c
.
fold f c v
accumulates the updates on c
with f
starting from v
.
The result is a signal of value f m_n (f ... (f m_1 v))
, where m_1
... m_n
are the messages that have been applied since the beginning of fold
. m_1
is a pseudo-message Set l
, accounting for the contents l
of c
at the time when accumulation starts.
Signal corresponding to contents