DEV Community

Discussion on: Explain (Timeline) Monads Like I'm Five

Collapse
 
nestedsoftware profile image
Nested Software • Edited

I can't really answer your questions, but I took a quick look at timeline-monad ( stken2050.github.io/timeline-monad/ ).

The idea seems to be very similar to js promises; except js promises can only be resolved or rejected once, whereas this code supports a sequence of events flowing from a single timeline. It would be like having a promise where the then function is called potentially multiple times. That seems to be its chief purpose as compared with promises.

I'm not sure what happens when there are multiple processing steps and each processing step is asynchronous though. As new events keep triggering the sync functions, do they queue up in the subsequent steps to make sure order is preserved? My gut feeling is that this approach is problematic.