I've been diving into the concept of monads for a few days now, trying to get a hold of their practical implications and I'm feeling closer to grasping them, but I need some clarification. I'm not really interested in technical jargon like "monoids" or "endofunctors" just yet. Here's my understanding so far:
1. Monads essentially wrap around other "things".
2. You can operate on the "thing" wrapped by the monad, which can include a chain of operations, making it seem like one simple step externally.
3. Monads that perform actions (like IO) tend to be "lazy", representing computations that aren't executed until needed.
4. We refer to retrieving the result of a monad as "unwrapping".
5. The processes of creating, transforming, and using a monad appear pure externally, but internally, they can manage impure actions without exposing those details.
Given this breakdown, I wonder if I've captured the essence of monads accurately. It seems like they shouldn't be that hard to understand, so I'm guessing there's more to it that I'm missing? My biggest challenge seems to be the different variations of monads. Even if they seem distinct, at their core, they all seem to help you obtain values regardless of how they go about it.
1 Answer
You're on the right path! Chaining and composition are indeed key elements of monads, and your breakdown does a solid job of separating those concepts. Many people struggle with monads because once you start seeing them in functional programming languages, it gets abstract pretty quickly. It's easy to get lost in category theory jargon when all you really want is to know how to use these concepts practically.
The main thing to remember is that while monads can seem complex, if you look at them through simple use cases, they become much clearer. Just take your time with it, and don't hesitate to ask more specific questions as you explore!

Exactly! I feel like understanding one simple example of a monad can really help demystify them, especially when you're not getting bogged down in the theory. Keep experimenting with practical examples, and it will start making more sense!