Monads make it easier to sequence computations in a lazy environment.
Ugh, monads again...
Making it easier to sequence computations in a lazy language (or thread state through functions in general) is the most boring (almost useless) thing about monads. A monad is the shape of the computation your program performs, you program it 10 times a week regardless of whether you even know it or not.
So the real thing is explicit representation (reflection) of monadic computation in a programming language. And explicit representation gives you new abilities: you can abstract over the thing. Like in your first example with HOF, when you have an explicit representation of functions (closures) you can start passing them around and write more abstract (more universal) functions.
The same with explicit monads: you can write functions passing monadic computations around, and write universal functions that work across iterators, async computations, exceptions and whatnot.
But the important point is not monads, it's another property you've glossed over: making new things possible. Some techniques do not make old things easier, they make new ones possible in the first place.
It's the second part of "make simple things easy and hard things possible". ;)
Ugh, monads again...
Making it easier to sequence computations in a lazy language (or thread state through functions in general) is the most boring (almost useless) thing about monads. A monad is the shape of the computation your program performs, you program it 10 times a week regardless of whether you even know it or not.
So the real thing is explicit representation (reflection) of monadic computation in a programming language. And explicit representation gives you new abilities: you can abstract over the thing. Like in your first example with HOF, when you have an explicit representation of functions (closures) you can start passing them around and write more abstract (more universal) functions.
The same with explicit monads: you can write functions passing monadic computations around, and write universal functions that work across iterators, async computations, exceptions and whatnot.
But the important point is not monads, it's another property you've glossed over: making new things possible. Some techniques do not make old things easier, they make new ones possible in the first place.
It's the second part of "make simple things easy and hard things possible". ;)