News for hackers. Stuff that matters.
Re:Functional programming is not popular because it is weird... by AnimalMuppet on Monday September 13, 2021 @11:27PM (#28519868)
It seems to me that if it looks totally procedural, then most programmers are going to reason about it totally procedurally. Using monads under the hood isn't going to buy you anything. In particular, it isn't going to make FP any more accessible, because the programmers won't be doing FP. They'll be doing procedural programming. Sure, the language may turn it into FP under the hood, but that's a detail of how the compiler generates its intermediate forms. That's not the claimed magic of FP; it's all in how you think. And if you think you're doing procedural, well... you don't get any FP magic that way.
Re:Functional programming is not popular because it is weird... by garethrowlands on Tuesday September 14, 2021 @04:22AM (#28521796)
True enough, when you're writing imperative Haskell, you're not hitting the claimed magic of FP.

But:

1. Haskell lets your write the majority of your code in pure style. And it helps you separate the imperative parts (like pure core, imperative shell).

2. The compiler tries hard to generate the same machine code as C. The difference is that it gives the programmer more options: because the imperative parts are values (actions), it's strightforward to calculate them, which you can't do in C (you'd need the preprocessor or maybe LISP macros).