With all the respect, I encourage you to take a look at it with another perspective: I see that you’re familiar with CT, leave it behind for a second and focus on my examples.
First of all, I added a Post Scriptum to the Story: this article is basically the explanation of the Monad by Brian Beckman (but in JS and extracting the binary operation) in his famous video “Don’t fear the Monad”. It is absolutely fine to say that I’m not an expert in the field and criticize me, and if I made some mistakes I’m glad that you show me where they are (it’s not that my life or credibility depends on Medium, I write an article every year or so), but what I find strange is that you’re saying that Brian (Software Engineer at Amazon and Microsoft, Physicist, worked at Nasa) is wrong. Please take a look at his video and PLEASE TELL ME (I’m not sarcastic) if what I say is wrong based on what he says, and I’ll correct. Again, I’ve simply gone from Haskell to JavaScript in my examples.
From the article you shared, I’d like to highlight this passage: “The difference is: In a monoid, any two elements can be appended, x <> y
is always defined. In contrast, in a category, the composition of arrows1 is defined only if the endpoint of the one arrow coincides with the starting point of the next, so the composition is a partial operation.”
In my article every function had the same type so it’s safe to say that they form a Monoid. If this monoid is not the one that the writer wants to highlight, that’s another matter. If the “Monoid in the category of endofunctors” is not this monoid, that’s another matter.
I’ve shown that having a collection of functions a -> M a and combining them with a binary operation generates another a -> M a function. I’ve shown that identity and associativity laws are enforced, therefore we have a Monoid. Why shouldn’t it be a Monoid? I made it clear at the beginning that I wanted to correlate the Monoid in abstract math with the Monad design pattern in FP. If this is not the Monoid you see, that’s perfectly fine, but it’s just another Monoid.
From Wikipedia, “Monad (functional programming)”:
Monads achieve this by providing their own data type (a particular type for each type of monad), which represents a specific form of computation, along with one procedure to wrap values of any basic type within the monad (yielding a monadic value) and another to compose functions that output monadic values (called monadic functions).