Comment by Chris_Newton

2 years ago

This hasn’t been my experience. One attraction of functional programming style is that you tend to separate pure/declarative code from effects, one way or another, and then express each using familiar patterns of computation or interaction that are the essence of what you’re implementing. This often results in simpler and more explicit code, with exactly the kind of high cohesion and low coupling you’re advocating.

It is no coincidence that an expressive functional language like Haskell has concise, descriptive names for numerous common folding patterns over common data structures such as mapAccumWithKey¹ that let you express what you want to achieve in just a line or two of code with minimal boilerplate or ambiguity, where using a generic loop in a mainstream imperative language would take 3x that and need a little thought to recognise the pattern being used and make sure there wasn’t anything else happening that was tangled up in the same code.

¹ https://hackage.haskell.org/package/containers-0.7/docs/Data...