3 ms·
This article argues that while promises support the required operations for monad, they do not support the monad laws: https://www.siawyoung.com/promises-are-a
by bazoom42 2y ago
This article argues that while promises support the required operations for monad, they do not support the monad laws:
https://www.siawyoung.com/promises-are-almost-monads/ https://www.siawyoung.com/promises-are-almost-monads/
- ryandv 2y agoIt's a good point. `Promise::resolve()` "flattens nested layers of promise-like objects (e.g. a promise that fulfills to a promise that fulfills to something) into a single layer." [0] The example was meant to be more of an illustrative analogy than an exact correspondence. [0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...