4 ms·
Sorry, I should've been more clear. You're right - you can absolutely build sequence out of the bind operation for any monad. Promise.all is not just sequence
by charliesome 9y ago
Sorry, I should've been more clear. You're right - you can absolutely build sequence out of the bind operation for any monad.
Promise.all is not just sequence though, there's some additional subtleties to it. In particular the fail-fast behaviour:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all#Promise.all_fail-fast_behaviour https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
That's the kind of fundamental coalescing operation that you cannot implement with bind on plain monads.