News for hackers. Stuff that matters.
Re:Why Functional Programming Should Be the Future of Software by gjulianm on Wednesday November 02, 2022 @09:35AM (#33435525)
> One of the big reasons why FP languages have so little penetration is because the advocacy usually feels like someone trying to talk you into a religion. (The other major impediment is gatekeeping)

I think one of the major reasons is because IO doesn't really fit well into the FP paradigm. All the theory and niceties take a second place when you find out that something as simple as "print a line here to console" isn't as simple as you thought it should be.

Re:Why Functional Programming Should Be the Future of Software by HideousKojima on Wednesday November 02, 2022 @09:55AM (#33435791)
Another problem is that as nice as avoiding state and side effects is, for any decently complex application there's a minimum amount of state that you simply have to handle, and as a general rule OOP languages seem to make dealing with state much easier. Mind you there are plenty of good ideas in FP, and discriminated unions is the feature I want added most to C#.
Re:Why Functional Programming Should Be the Future of Software by thinkharderdev on Thursday November 03, 2022 @09:53AM (#33450978)
> as a general rule OOP languages seem to make dealing with state much easier

I disagree. One of the most significant benefits of FP (and pure FP in particular) is being able to deal with mutable state safely in concurrent programs. This is essentially the core problem which effect systems try to solve.

Re:Why Functional Programming Should Be the Future of Software by kaba0 on Wednesday November 02, 2022 @10:38AM (#33436533)
Isn’t this IO thing a bit overused? There are more FP languages that are not as pure as Haskell, but even if we only do IO through a special monad it is not too bad at all.

And I say that as someone who is very much fore “practical FP” — I do think that local mutability is sometimes simply the better fit for a problem.

Re:Why Functional Programming Should Be the Future of Software by gjulianm on Wednesday November 02, 2022 @11:44AM (#33437687)
> there are more FP languages that are not as pure as Haskell

I mean, that's precisely the point I'm making, that IO doesn't fit into the FP paradigm and that languages that make IO easier necessarily deviate from it. And once you bring non-FP concepts into an FP language, most people will reasonably question why do that instead of the easier way, which is bringing FP concepts into imperative languages.

Re:Why Functional Programming Should Be the Future of Software by aranchelk on Wednesday November 02, 2022 @12:51PM (#33438898)
Pure functional languages model IO with monads, which are very much functional (function composition within a context) and IMO easy to use. This ease of use is probably why JS adopted the pattern with native promises -- async/await. They fit well into otherwise imperative code and people seem to to like them.
Re:Why Functional Programming Should Be the Future of Software by tsimionescu on Wednesday November 02, 2022 @03:45PM (#33441894)
Pure functional languages can very well have normal IO. It's Haskell's lazyness that mostly forced it to use monads for IO, for better or for worse. In a pure FP language with strict evaluation semantics, IO can easily be implemented as a pure function foo -> (World, Input) -> (World, Output).
Re:Why Functional Programming Should Be the Future of Software by tome on Saturday November 05, 2022 @09:25AM (#33481241)
That's not true at all. If you could use that implementation in a strict language (which you can't) you could equally-well use it in Haskell.
Re:Why Functional Programming Should Be the Future of Software by throwawaymaths on Wednesday November 02, 2022 @12:56PM (#33439030)
Arguably the best platform for the general io use case is functional.

From how when you console in to a cluster and run a command on another node, the standard io is redirected to you, to how tcp/up and up sockets are managed by the stdlib, it's really hard to beat Erlang.

Re:Why Functional Programming Should Be the Future of Software by valenterry on Wednesday November 02, 2022 @12:43PM (#33438757)
I think the context here is pure functional programming. So not just replacing e.g. loops with mapping and such things, but actually making effect-handling explicit. The IO type (or otherwise deferred-type) is essentially for that. Saying it doesn't fit into the FP paradigm doesn't make sense. Without IO, FP is useless because you simply cannot "do" anything at all.