package cumulus
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=f8b36587ef1cd547541e16fceb7b81cc1bbed26325200e51248564d094beff25
sha512=5515aff4a852decb9e9a078aa6692eb6c2d7108d55b3385396faa7f55f5d5af9c510911608e0f5a3e24ce736fe0742dd227bcc683eb56b45890495f38da5ac0e
Description
Cumulus defines a signal-like type, which facilitates differential updates of the underlying value. When a cumulus signal is changed, it emits a patch along with the new value, allowing consumers to integrate it into an existing value rather than rebuilding its value from scratch. Cumulus is based on the React FRP library.
Added to opam-repository:
README
Status
This library is in a working state, but the interface is not stable yet.
Synopsis
Cumulus defines a signal-like type, which facilitates differential updates of the underlying value. When a cumulus signal is changed, it emits a patch along with the new value, allowing consumers to integrate it into an existing value rather than rebuilding its value from scratch. Cumulus is based on the React FRP library.
Documentation
Overview
The main type ('a, 'b) Cumulus.t represents a cumulus signal over a state of type 'a with changes represented by 'b. The idea is that an (state, change) Cumulus.t instance makes sense if one can formulate a function
val patch : change -> state -> staterelating the previous value of the cumulus signal with the current via the current change component. If this is the case, the cumulus signal can be constructed from an initial value and an event of changes using
val integrate : ('da -> 'a -> 'a) -> 'da event -> 'a -> ('a, 'da) tHowever, it is not required that patch is manifest and, as will be seen below, the changes need not be complete for cumulus signals to be practically useful.
As special cases
val of_event : 'a event -> (unit, 'a) tshows how a react event is the analog of a cumulus signal where no state is retained, and
val of_signal : 'a signal -> ('a, unit) tshows how a react signal is the analog of a cumulus signal where no information is provided about what changed from one value no the text.
The state of a cumulus signal can be pure, so that a new state is constructed on each update of the signal, e.g.
('a list, [`Remove of int | `Add of int * 'a]) Cumulus.tor mutable, allowing re-using the state between updates when possible, e.g.
('a array, [`Set of int * 'a | `Resize of int]) Cumulus.tAn essential part of the API is a set of lifting functions of different arities, which allows deriving new cumulus signal from existing cumulus signals. The basic pattern is:
let cs =
let init state1 ... stateN =
... (* construct the initial state from input status *)
in
let patch (state1, change1) ... (stateN, changeN) state =
(* inspect input states and changes *)
if ... (* our state changes *) then
let state', change' = ... in
Cumulus.Patch (state', change')
else
Cumulus.Keep state
in
Cumulus.l2 ~init ~patch cs1 cs2See tests/test_isecn.ml for a complete example.
Dev Dependencies
None
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building cumulus with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.0.1 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure