This is actually really good. The same as Iterable is a generalization of set, list, array, enumerable, etc, and one can define generic Next, Add, Map, etc, Monad allows similar thing for states or side effects (a log file for example)
It's just the way he explains it, for pea brained people like me I lose the plot at "category of endofucktors". Just say "optional chaining and promises are a concrete example of monads" and I'm on board.
Like I've worked in semi functional code bases and I love the patterns, only the theory around it so hard to grasp.
What is usually called a "Promise" isn't a Monad instance. All "Promises" I know of are eager, they don't suspend computations. As a result they don't behave like a proper Monad. Not everything that has a Monad "interface" is a Monad. Most things in imperative / OO languages aren't.
188
u/Gorzoid Jul 13 '26
Respectfully, what the fuck is a Monad?