I disagree that anything on your "so do" list is hard to explain. At least, I feel like I understand all of them, but I still don't understand Monads. And I've probably spent 10x the amount of time reading (and still not comprehending) Monad tutorials than I have all of the other concepts combined.
I'm curious how much time you're spent "doing monads" compared to reading about monads. The reason that I bring this up is that monads didn't click for me until I had hands on experience with a few different monad instances and could see the abstraction take shape in different ways. If that doesn't apply to you, that's ok too. It's fun to understand other people's methods of conceptualization.
I have no idea how much time I’ve spent doing monads because I still don’t know what they are. It’s possible I’ve done “monadic” things in the code I already write, but I have no idea.
I don’t know any Haskell at all, and it seems to be the only language out there where people think monads are a thing you need to learn, so I definitely have no motivation to learn them outside of curiosity.
But I am curious about them, enough to read every tutorial I come across about them. But I still have no idea what they are.
It's definitely possible you've already done monadic things in code. If it's any consolation, I would not have ever been able to grasp monads by reading tutorials alone and the monad laws are simply too abstract for me to have envision a concrete usage. I learned without touching Haskell at all and it's my opinion is that Scala + Cats is a much easier onramp to monads than Haskell.
You sound like a kind and curious person. If you ever want a one-on-one walkthrough please reach out to me (email in bio). Everyone deserves the chance to understand something if they want to.
Yes I have, I helped teach some CS courses in college, plus I myself learned them in my very earliest days of programming. It's pretty common for those to be among the first concepts taught.
I'd say that your list is full of things that have practical examples when you consider how real, physical computers work. Boolean logic can be shown by example by showing physical transistor circuits, and I'd argue that people can understand them quite easily. Pointers/variables can be shown by explaining how memory addressing works on real machines, and what CPU instructions correspond with the actual code you're writing.
Monads however, seem to be this purely abstract mathematical concept that comes from CS-as-a-math-discipline, which although useful, requires you understand ton more theoretical background before you can approach it. At least that's my experience -- I still don't understand them and every tutorial I've read either makes them look like magic (ie. doesn't actually explain them) or tries to take a mathematically rigorous approach and I get lost in the weeds.
I know intuitiveness is very subjective, but I'd wager that by numbers, many more people are able to understand pointers/mutable variables/macros/boolean logic/etc more easily than they can Monads.
You don’t need much of any theoretical mathematical knowledge to understand monads. What you need is comfort and experience reading mathematical definitions. For most people, that means they’ve studied a lot of math. The famous John von Neumann quote is bang on here:
Young man, in mathematics you don't understand things. You just get used to them.
I agree. Almost all of the difficulty is just not getting how mathematicians think or communicate.
Honestly I think a lot of effort is wasted starting with this stuff rather than more motivated examples... But the interest is the harder thing to come by, so at least they're learning something.
The first one I think cuts through all of the crap surrounding them. They're just a design pattern. And the second one helps motivate them, showing the many contexts where the design pattern many apply.
What would be my motivation for learning Haskell other than learning monads? Learning an entire programming language (one that expressly states practicality as one of its non-goals and ostensibly only exists to advance type theory) just to that I can learn a concept that only appears useful in that language, seems like a waste of my limited time.
It's "write some Haskell", not "learn Haskell". It's much harder to learn Haskell than understanding monads, you just need to see how some look like on practice.
But, well, I don't have any reason for you to do that. You just asked how, and I gave you a way. If you don't have any interest in learning it, there's absolutely no problem, but posting "I never really tried, but that thing is bad because I haven't learned it already" FUD is pretty bad.
My contention is that people are learning monads because they’re on a journey to learn Haskell, then when they finally grok them, they turn around and say they’re this big important thing that all programmers should understand, because Haskell showed them how important they are.
But so far, no monad tutorial has made a good case for why they’re actually useful, other than for learning Haskell. And most advice for how to learn them sounds exactly like what you said: “oh if you still don’t get it, you just need to write more Haskell.” You can see why that’s a bit of a disappointment, right?
Basically, you have people making this argument:
- monads are important outside of Haskell
- to understand why, you have to learn them
- to learn them, you should write Haskell
Which I’m sure you can understand comes off as a bit unconvincing.
Oh, ok. If you want to design a language nowadays, knowing monads (and other abstractions) is absolutely necessary, even if just to reject them in an informed fashion.
If you want to use a language to program, knowing them will help you with approximately nothing, because most languages either have awful ergonomics for that kind of abstraction or bring them on much more limited ways that you are better learning how they specifically apply to the language than the general concept. If you learn the general concept, the specific cases will be easier, but unless you plan on learning several languages, it's not worth it.
Anyway, one large exception is if you plan on doing heavily abstract C# libraries. The C# support for monads is almost as general as Haskell.