3 ms·
You understand the data structure. Probably the chaining rule, even probably the monoid in the category of endofunctors. What you don't understand is the existe
by javcasas 3y ago
You understand the data structure. Probably the chaining rule, even probably the monoid in the category of endofunctors. What you don't understand is the existence of it.
Monads is a solution for dealing with IO in a strongly typed programming language, where we want all functions to be pure, and we don't have access to linear types. (almost) Every other programming language, when it had the chance at doing this, just threw the towel without a fight, and decided to allow IO everywhere. Haskell decided to stick to its principles instead, and produced something different, guided by a different set of constraints. Different means with different tradeoffs in different places. If Haskell instead decided to allow mutability everywhere, like most programming languages, we wouldn't be talking about it. Because it would be another language with weird syntax, and you can find a lot of them in the list of defunct programming languages at wikipedia.
And the juice is worth the squeeze if you want to see breakthrough things in programming, and not just another Algol with updated syntax.
For reference, other samples of groundbreaking (to some degree) stuff:
* Rust: mutability only when the borrow checker allows it
* Coroutines/continuations: functions that depart away from the entry/exit model
* Prolog: a programming language constructed around functions with 4 connection points: enter/exit/fail/redo