4 ms·
I suspect this is still not satisfying for people wanting to really know what a Monad is. Perhaps these simplified explanations can get away with explaining Fun
by proc0 5y ago
I suspect this is still not satisfying for people wanting to really know what a Monad is. Perhaps these simplified explanations can get away with explaining Functor (more so the "mechanics" of it) but it starts breaking down for Monad.
I don't think there is a shortcut... these are highly abstract concepts.
Abstraction is about exposing the most essential parts of something... Category Theory is perhaps the mathematics of abstract composition, exposing the most essential parts of how to combine (in the abstract). Monad and Functor arise from CT, and thus, are very abstract concepts, built from the axioms of an already abstract subject matter. This is why it's hard to "simplify" them any further. The formal definition of a Monad is itself the simplest way to expose it. The fastest way to grapple with it is through the axioms of CT, precisely because CT is arriving at this concept by abstraction; by only thinking about the most essential parts of it.
That is probably not a satisfying explanation (to tell someone you need to learn axioms and laws before understanding this concept), but the alternative is to simplify and/or abstract something that is already as simple and as abstract as can be, albeit with esoteric names, and thus inevitably complicating it and shrouding the concept instead. i think the reason so many Monad tutorials aren't as satisfying is because they attempt to explain both a mathematical, abstract concept and also how it applies to programming, at the same time (without explicit separation). The latter is practical, the former is very abstract, and the bridge between them is very complex and usually left out, leaving the reader scratching their heads how and why you go from one to the other.
It's worth mentioning Bartosz Milewski here (links below), as he has bridged this gap for many, but as mentioned, there is no shortcut.
https://bartoszmilewski.com/ https://bartoszmilewski.com/
https://www.youtube.com/channel/UC8BtBl8PNgd3vWKtm2yJ7aA https://www.youtube.com/channel/UC8BtBl8PNgd3vWKtm2yJ7aA
- siraben 5y agoThere was a particular moment I remember from Milewski's monad video, where likened monad tutorials to a situation where you arrive on a remote island and the islanders ask you to explain what a function is. One's first instinct might be to give a bunch of examples, for instance, you can have a function that takes a list of fishermen and order them by the number of fishes they caught, or a function to turn barley into beer, etc. Upon hearing this, the islanders think that functions must be some magical panacea, and so you backtrack on that and try to talk about functions as being like animals, they take input and produce output (good luck with function composition). The situation is like that with monads. They are far removed from the world of programming (the fact that there were connections at all to effects was remarkable!), but as such, you have to learn the ambient theory in which monads reside to really grok it.