Hi all,
I can’t figure out how to implement a function that takes as arguments
f : 'a -> 'b -> 'c Lwt.t
x : 'a React.signal
y : 'b React.signal
- (probably:
init : 'c
)
and returns a 'c React.signal
containing (initially init
and then) the successive values of f [x]_t [y]_t
once they are computed.
In the unary case, I achieve what I want by
let map_async ?eq init f x =
React.S.hold ?eq init (Lwt_react.E.map_s f (React.S.changes x))
but I’ve failed for hours to solve to the binary case…
Is it because it is forbidden? why? or am I missing something completely obvious?
Subsidiary question that might help me understanding where my mental representation is wrong: Why the Lwt_react.E.l*_s
functions return “regular” 'a React.event
whereas the Lwt_react.S.l*_s
functions return some 'a React.signal Lwt.t
?