Callbacks are one particular monad, not monads in general: https://jsdw.me/posts/haskell-cont-monad/
Callbacks are one particular monad, not monads in general: https://jsdw.me/posts/haskell-cont-monad/
> Programming with monads strongly reminiscent of continuation—passing style (CPS), and this paper explores the relationship between the two. In a sense they are equivalent: CPS arises as a special case of a monad, and any monad may be embedded in CPS by changing the answer type.
It seems to confirm the argument that monads are not that useful or pervasive outside of Haskell.
But what your describing is the actual value proposition of monad though! It's literally the construct you use to avoid excessive unwraps.
Look at the type signature of bind:
m a -> (a -> m b) -> m b
It returns m b. Not m (m b). Not m (m (m b)).> but they aren’t straightjacketed into the ivory tower “laws” in absolutely every edge case
In other words, you can't abstract over them. If you have libraries that manipulate monads, they will be incompatible or buggy, because they will assume (by design) behaviour that a non-monad will not live up to.
I can assure you that JS libraries work with Promises just fine.