|
|
|
|
|
by skwosh
3981 days ago
|
|
I agree, and I actually think a better word for `bind` is `then`. For anyone unfamiliar, the `then` of Promises corresponds to the monadic `bind` or `flatMap` (if the given function returns a Promise) or the functorial `map` (if the given function returns a plain value). A monad then is just the interface shared between Promises (`then` and `resolve`, collections (`flatMap` and `wrap`), etc. The hard part for me was visualising the pattern for more complicated types like parsers (functions from strings to results) and continuations. |
|
But there are some that do not. For instance, the "reverse state monad" would not make sense with 'bind' named 'then' since... as the name implies, state flows backwards through time in it!