Mithril currently ships a barebones streams library, which serves both to migrate code using the old m.prop and to add reactive programming features for working with async data.
Currently it supports several of the more commonly used fantasy land features (map, merge, combine.) combine, while useful, tends to be a bit cumbersome to use due to sending streams rather than values to the combiner callback.
I propose that we add stream.lift, which in most cases is preferable to stream.combine. It will work similarly to combine, however the callback will receive unwrapped values rather than streams. Here's the difference:
// using combine
c = stream.combine((a, b) => a() + b(), [astream, bstream])
// using lift
c = stream.lift((a, b) => a + b, astream, bstream)
Mithril currently ships a barebones streams library, which serves both to migrate code using the old
m.prop
and to add reactive programming features for working with async data.Currently it supports several of the more commonly used fantasy land features (
map
,merge
,combine
.)combine
, while useful, tends to be a bit cumbersome to use due to sending streams rather than values to the combiner callback.I propose that we add
stream.lift
, which in most cases is preferable tostream.combine
. It will work similarly to combine, however the callback will receive unwrapped values rather than streams. Here's the difference:(Note that both signatures match flyd's.)
The implementation should be quite small:
Here is a flems example to play with.