Re:JavaScript Promises Discussion: Make Them Monadic? (2013)
by icc97 on Thursday February 15, 2018 @06:39PM
(#16388770)
Here's a half baked explanation, as in just the flatmap part.
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]
Re:JavaScript Promises Discussion: Make Them Monadic? (2013)
by ngcazz on Thursday February 15, 2018 @07:38PM
(#16389033)
Because the point is mostly lost on the unrelated analogies most tutorial writers use. A monad is a mathematical construct. Trying to explain them in terms of what makes sense to you, because your analogy results from your understanding, isn't likely to be more helpful than outright accepting what they represent, mathematically speaking, then putting that to use in your code.
Re:JavaScript Promises Discussion: Make Them Monadic? (2013)
by rmrfrmrf on Thursday February 15, 2018 @11:06PM
(#16389774)
A monad is most simply described as the quantum superposition of the state of being (or not being) a burrito.
Re:JavaScript Promises Discussion: Make Them Monadic? (2013)
by zenhack on Friday February 16, 2018 @02:32AM
(#16390616)
rmrfrmrf made an allusion to this below (which I also linked to in another nearby comment):
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.
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.