3 ms·
Actually, just learn the construct `Promise.then().catch()` and u already know how to use Monad in your code. The `then` is the `bind` of Monad. What's complica
by revskill 5y ago
Actually, just learn the construct `Promise.then().catch()` and u already know how to use Monad in your code. The `then` is the `bind` of Monad. What's complicated here ? Want `do` syntax ?
a <- method b
c <- method a
is equivalent to
a = await method(b)
c = await method(a)
Again. Use javascript to learn Monad in real world is a better way to learn.
- Dylan16807 5y agoThat doesn't tell me a single thing about what 'monad' means. It's like having someone run hello world in java and declaring they know what 'static' means.
- wyager 5y agoThat’s an example of a specific monad, not the definition of the general concept of a monad. Also, JS promises are not really monads. They lack denotational equality, so they can’t be said to obey the monad laws.