by kazinator · 9y ago · 0 comments
Haskell doesn't have state but you have multiple models to choose from, from simple folds to STM or State or Reader or Writer Monads all of which serve different purposes and do different jobs well.
Haskell has no state support built in, it is all delegated to libraries.
So:
C++ has excellent IO support, but the language doesn't embrace IO at all.
Haskell has excellent State support, but the language doesn't embrace State at all.
f(cout << x, cout << y)
where we don't know whether x is sent to cout first or y.C++ statements could be added to C++ (e.g. as a compiler extension). They would be straightforward to use; C++ doesn't inherently reject that the way Haskell and its ilk reject sequencing and state.
Someone who understands where that support is and how to use it should rewrite atrocities like:
https://rosettacode.org/wiki/Assigning_Values_to_an_Array#Ha...