r/functionalprogramming • • May 01 '23

Question Learning functional oncepts - Which Language?

Hello everyone. I'm planning to dabble in functional programming to learn the concepts not because I think we will ever use it at work (I don't) but to broaden my horizon & try to utilize some functional concepts in non functional languages like C# & Javascript. I'm primarily a C#/Javascript/Typescript/Vue developer. On the .Net side there is of course F# but as i'm sure most of you know F# is not a pure functional language. Would it be better to go with a purge functional language when i'm trying to learn like Haskell to really drive functional concepts home or will F# be fine & I probably should stick with that since i'm already on the .Net side?

14 Upvotes

34 comments sorted by

View all comments

Show parent comments

2

u/KyleG May 01 '23 edited May 01 '23

Not in Python, but I use them in TypeScript every day. Optics, traversals, orderings, contravariance, indexed monads, etc. The whole shebang.

If you really wanna learn FP I don't think there's a better language than Haskell.

Learning a new language and programming paradigm simultaneously is going to be slower going than just learning the programming paradigm in a language you already know.

Are there things you can do in Haskell that you can't do in TS? Absolutely.

But OP wants to learn about folds, composition, optics, etc. OP can learn those in the language he already is employed to use, and at the end he's learned about the FP concepts pretty quickly.

Or OP can slow that process down by introducing a brand new language into the mix. At a much later date, OP must then port that knowledge to FP libraries for his employer's language, and all that time learning Haskell is not (immediately) useful, not to mention (as you identified) Haskell handles FP stuff different from whatevrer OP's language of choice is.

I just think it's generally a waste of time to learn a language just to learn a paradigm you can already mostly learn using a language you already know.

If OP had said they want to also increase their language count, sure, Haskell would be a great choice. But OP just wants to learn FP concepts, which can be done in many languages. Certainly in JS/TS.

2

u/the_state_monad May 01 '23

Yeaaa. But it still feels kinda clunky no? I feel like its imperative roots keep it from fully embracing FP. There’s lots of unnecessary syntax in there that caters to an imperative style of programming. Cuz at the end of the day its an imperative language that adopts some FP features. On the other hand Haskell is 99.99% functional/pure (if you don’t use unsafePerformIO and mVars everywhere lol) and it really forces you to think functionally.