2 ms·
It's not about state, it's about denotational semantics. A pure functional language can use denotational semantics to embed non-pure languages/programs/concepts
by lmkg 17y ago
It's not about state, it's about denotational semantics. A pure functional language can use denotational semantics to embed non-pure languages/programs/concepts, because the denotational semantics of non-pure concepts are still pure. State is the most common example of a non-pure concept that many programmers miss in Haskell, but it's not the only one. So it's not a question of state being useful or awesome or even a good idea, but rather a question of how Monads are how Haskell escapes its own constraints to express 'foreign' ideas.
My point was that, in practice, if pure functional langues ruled the world and did not include built-in Monads, many applications would re-invent them anyways because of their expressivity, in much the same way that C applications are said to re-invent LISP.