by Nadya · 8y ago · 0 comments
If you'd like to go down a rabbit hole of category theory look up the phrase "A monad is just a monoid in the category of endofunctors, what's the problem?" - a fun quote that a lot of monad explanatory tutorials will quip. Not that it will help - because anyone writing a monad explanation already suffers from the first quote: they're incapable of explaining them.
I had read 30 or 35 different monads-for-Javascript tutorials/guides/explanations before I finally thought I grokked it. None of them have helped and I'm still not sure my understanding of them is correct.
map is understood in javascript.
So you 'just' need to make the leap to flatmap. Which is mapping something and flattening the result.
So still you need to learn is what flatten is. But that's not too hard to learn.
Try the funfunfunction video [0]
https://byorgey.wordpress.com/2009/01/12/abstraction-intuiti...
The short version is: don't stare at explanations trying to grok it. Start hacking and keep an eye out for patterns.