Railway Oriented Programming(ROP) is explained here:
https://fsharpforfunandprofit.com/rop/
Is there any way to use this pattern with Fluture
I can do ROP with these two helper methods like this:
const bind = f => x => Future.attempt(() => f(x));
const bindAsync = f => x => Future.tryP(() => f(x));
Future.of("TEST")
.chain(bind(doThis))
.chain(bind(doThat))
.chain(bindAsync(doThisAsync))
.chain(bindAsync(doThatAsync))
.chain(bind(doAnotherThing))
.chain(bindAsync(doAnotherThingAsync))
.
.
.
Is there a better way to remove bind
, bindAsync
and do binding automatically?