3 ms·
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`
by skwosh 11y 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.
- tel 11y agoI kind of agree with this... In many monads binding creates a time-dependent sequentiality! 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!