Hacker News new | ask | show | jobs
by Waterluvian 1081 days ago
Be very careful with "why do X hate Y?" Generally speaking, if someone comes out as outright hating Y, their opinion should be taken with a pound of salt.

Functional programming is fundamentally at odds with imperative constructs. It's not that people hate them, it's that they generally just don't fit the paradigm of "build a pipeline of steps (functions) and feed data into it" as well. Most of my software is functional, but you will find the occasional C-style loop, especially if the map/filter/reduce alternative is ridiculously complicated to read.

2 comments

I find concat pipelines to become unwieldy very quickly. I’ll generally turn to an imperative loop when my output doesn’t fit neatly into an FP paradigm, or requires a ridiculous amount of translations to accomplish. At the end of the day, I still want to write performant code.
>"build a pipeline and feed data into it."

Arrows in Haskell are actually pretty good at building functional left to right data processing pipelines.

Yeah for sure! The tricky, prickly part of talking about FP is that we get into semantics a lot (eg. I'm sure there's Haskell experts who wouldn't consider JavaScript's `Array.prototype` functions to count as FP). Generally I'm thinking about `foo.map` vs. `for n in foo...`. Maybe "imperative" is a bit of a loaded term for this point.
Arrows [1] are great, not sure why you were getting downvoted on that.

---

[1] https://en.wikibooks.org/wiki/Haskell/Understanding_arrows