News for hackers. Stuff that matters.
Re:What's functional programming all about? (2017) by bazoom42 on Thursday September 05, 2024 @02:30AM (#41454115)
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/

Re:What's functional programming all about? (2017) by ryandv on Thursday September 05, 2024 @02:46AM (#41454191)
It'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/Refe...