By "combinator" do you mean combinator as in the combinator pattern?
I have no idea what value your comment brings us except a way for people who already agree with you to give you upvotes, and what's the point in that?
By "combinator" do you mean combinator as in the combinator pattern?
I have no idea what value your comment brings us except a way for people who already agree with you to give you upvotes, and what's the point in that?
This drive-by-question style makes it hard for me to know what your real point is. Are you saying that an assignment does the same thing as a monad? OK. That it is a monad? I doubt it; assignment doesn't have the right operators (you might argue that it does, but you'd have to really stretch it.) That it's just as simple and easy to understand as a monad? I call BS.
> I have no idea what value your comment brings us except a way for people who already agree with you to give you upvotes, and what's the point in that?
That kind of rhetoric is against the site guidelines.
Using (something similar to) a monad (Javascript promises do not form a monad) successfully is different than using the monad abstraction successfully.
> and they are huge fans of do-notation in the from of async/await.
Async / await is not monadic do-notation. Arguably, it has a somewhat similar relationship to the underlying promise abstraction that do-notation had to the monad abstraction, but they aren't the same thing.
> Imperative programmers do not seem to have an issue with the idea of assignment, why are monads problematic
Why are the two halves of this sentence connected to each other since they have no relationship other than the proximity they've been (bizarrely) placed in.
function bindPromise(p, f) { return p.then(f); } function returnPromise(a) { return new Promise.resolve(a); }
Proof of the laws left as an exercise to the reader :).
But yes, you are correct that promises do quite a bit more than only being a monad, for example because of how they treat errors.
EDIT: I concede, I am wrong! https://buzzdecafe.github.io/2018/04/10/no-promises-are-not-...
I also think there's nothing precluding some Monads to be good ideas and others to be bad ideas.
Similarly, the delivery could have a big impact. So it might be the theory of it is good, but a better delivery in terms of programming UX needs to be used. So maybe the dot notation somehow delivers better then the do notation.
Having said all that, I like Haskell, better than JS.
return x; return x -> return yield*x
return yield x; yield x -> yield*x
(at least, I think it is; I may have made a mistake)