3 ms·
This isn't true at all, promises in JavaScript are monadic, as are chains of conditional logic. Stuff like this is literally everywhere: if a: b = f(a)
by alephu5 6y ago
This isn't true at all, promises in JavaScript are monadic, as are chains of conditional logic. Stuff like this is literally everywhere:
if a:
b = f(a)
if b:
c = g(b)
...
else:
p()
Which as a monad would be something like
A >>= f >>= g >>= h >>= ...
I've built several classes with a covert "return" and "bind" operation to keep this kind of programming clean, I just don't tell anyone it's a monad.