by implicit · 11y ago · 0 comments
Particularly, I really like their solution to async programming. I'm paraphrasing a bit, but it looks very nearly identical to an ordinary let ... in binding:
lwt result = xhr "http://example.com" in
lwt secondResult = xhr "this url will be fetched after the first one completes"
and thirdResult = xhr "this url will be fetched in parallel with the second"
in (* use result, secondResult, and thirdResult here *)
This desugars into a nested callback structure having the right shape. Step(
function() {
getURL1(this.parallel());
getURL2(this.parallel());
getURL3(this.parallel());
},
function(err, res1, res2, res3) {
}
);
[0] https://github.com/creationix/step