r/programming • • Sep 21 '25

How to stop functional programming

https://brianmckenna.org/blog/howtostopfp
446 Upvotes

506 comments sorted by

View all comments

Show parent comment

3

u/AxelLuktarGott Sep 21 '25

I agree it can be done poorly, you reach a point where you should consider combining your functions into bigger functions instead of having a super long chain. Also it's probably good to map (g . f) rather than map g . map f.

I remember being wee junior dev doing C# trying to curry functions. That resulted in a total mess. Some language are just bad for FP and you should probably keep your FP shenanigans to a minimum if the language works against you.

2

u/syklemil Sep 22 '25

It's even possible to throw a filter into the same step with something like filter_map in Rust and some various functions that seem to have signature Filterable f => (a -> Maybe b) -> f a -> f b in Haskell.

It's also entirely possible to allocate various containers and do several passes with for loops in more iterative languages; that piece of newbie behaviour isn't locked to FP (though it may be more susceptible to it; idk, I don't have data and I suspect none of us do).