Module Lwt_react.S
module S : sig..end
include React.S
Monadic interface ¶
val return : 'a -> 'a Lwt_react.signal
Same as const.
val bind :
?eq:('b -> 'b -> bool) ->
'a Lwt_react.signal ->
('a -> 'b Lwt_react.signal) -> 'b Lwt_react.signal
bind ?eq s f is initially f x where x is the current value of s. Each time s changes to a new value y, bind signal f is set to f y, until the next change of signal.
val bind_s :
?eq:('b -> 'b -> bool) ->
'a Lwt_react.signal ->
('a -> 'b Lwt_react.signal Lwt.t) -> 'b Lwt_react.signal Lwt.t
Same as Lwt_react.S.bind except that f returns a thread. Calls to f are serialized.
Lwt-specific utilities ¶
val with_finaliser :
(unit -> unit) -> 'a Lwt_react.signal -> 'a Lwt_react.signal
with_finaliser f s returns a signal s' which behave as s, except that f is called when s' is garbage collected.
val limit :
?eq:('a -> 'a -> bool) ->
(unit -> unit Lwt.t) -> 'a Lwt_react.signal -> 'a Lwt_react.signal
limit f s limits the rate of s update with f.
For example, to limit it to 1 per second, you can use: limit (fun () -> Lwt_unix.sleep 1.0) s.
val keep : 'a Lwt_react.signal -> unit
keep s keeps a reference to s so it will never be garbage collected.
Threaded versions of React transformation functions ¶
The following functions behave as their React counterpart, except that they takes functions that may yield.
The _s suffix means that calls are serialized.
val app_s :
?eq:('b -> 'b -> bool) ->
('a -> 'b Lwt.t) Lwt_react.signal ->
'a Lwt_react.signal -> 'b Lwt_react.signal Lwt.t
val map_s :
?eq:('b -> 'b -> bool) ->
('a -> 'b Lwt.t) -> 'a Lwt_react.signal -> 'b Lwt_react.signal Lwt.t
val filter_s :
?eq:('a -> 'a -> bool) ->
('a -> bool Lwt.t) ->
'a -> 'a Lwt_react.signal -> 'a Lwt_react.signal Lwt.t
val fmap_s :
?eq:('b -> 'b -> bool) ->
('a -> 'b option Lwt.t) ->
'b -> 'a Lwt_react.signal -> 'b Lwt_react.signal Lwt.t
val diff_s :
('a -> 'a -> 'b Lwt.t) -> 'a Lwt_react.signal -> 'b Lwt_react.event
val sample_s :
('b -> 'a -> 'c Lwt.t) ->
'b Lwt_react.event -> 'a Lwt_react.signal -> 'c Lwt_react.event
val accum_s :
?eq:('a -> 'a -> bool) ->
('a -> 'a Lwt.t) Lwt_react.event -> 'a -> 'a Lwt_react.signal
val fold_s :
?eq:('a -> 'a -> bool) ->
('a -> 'b -> 'a Lwt.t) ->
'a -> 'b Lwt_react.event -> 'a Lwt_react.signal
val merge_s :
?eq:('a -> 'a -> bool) ->
('a -> 'b -> 'a Lwt.t) ->
'a -> 'b Lwt_react.signal list -> 'a Lwt_react.signal Lwt.t
val l1_s :
?eq:('b -> 'b -> bool) ->
('a -> 'b Lwt.t) -> 'a Lwt_react.signal -> 'b Lwt_react.signal Lwt.t
val l2_s :
?eq:('c -> 'c -> bool) ->
('a -> 'b -> 'c Lwt.t) ->
'a Lwt_react.signal ->
'b Lwt_react.signal -> 'c Lwt_react.signal Lwt.t
val l3_s :
?eq:('d -> 'd -> bool) ->
('a -> 'b -> 'c -> 'd Lwt.t) ->
'a Lwt_react.signal ->
'b Lwt_react.signal ->
'c Lwt_react.signal -> 'd Lwt_react.signal Lwt.t
val l4_s :
?eq:('e -> 'e -> bool) ->
('a -> 'b -> 'c -> 'd -> 'e Lwt.t) ->
'a Lwt_react.signal ->
'b Lwt_react.signal ->
'c Lwt_react.signal ->
'd Lwt_react.signal -> 'e Lwt_react.signal Lwt.t
val l5_s :
?eq:('f -> 'f -> bool) ->
('a -> 'b -> 'c -> 'd -> 'e -> 'f Lwt.t) ->
'a Lwt_react.signal ->
'b Lwt_react.signal ->
'c Lwt_react.signal ->
'd Lwt_react.signal ->
'e Lwt_react.signal -> 'f Lwt_react.signal Lwt.t
val l6_s :
?eq:('g -> 'g -> bool) ->
('a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'g Lwt.t) ->
'a Lwt_react.signal ->
'b Lwt_react.signal ->
'c Lwt_react.signal ->
'd Lwt_react.signal ->
'e Lwt_react.signal ->
'f Lwt_react.signal -> 'g Lwt_react.signal Lwt.t
val run_s :
?eq:('a -> 'a -> bool) ->
'a Lwt.t Lwt_react.signal -> 'a Lwt_react.signal Lwt.t