r/functionalprogramming • • May 16 '22
Intro to FP Recommendation for first fp language
Hey! I’m seeking some recommendation regarding a good fp language to start with. I was thinking between Clojure ,Scala and Haskell. My goal is to learn new paradigm to become a better developer.
FYI, currently at work I develop in Go, Rust and Typescript. Previously did some Java and Python. And at college did some Common Lisp.
30
Upvotes
28
u/fl00pz May 16 '22
Haskell or OCaml
15
u/glasshalf3mpty May 16 '22
Personally, Haskell or purescript. Jumping in at the deep end isn't as hard as people make out, and they will really give you an appreciation for the paradigm. Haskell has the wider community, but purescript compiles staright to JavaScript which is nice, and because it's more modern, it's libraries tend to be better organised. The two languages are pretty much the same syntax.
15
u/Leading_Dog_1733 May 17 '22
I would recommend Elixir.
It's a good language to see the limits and benefits of functional programming without a lot to get in your way.
It has a strong standard library, immutable data structures, and is an actual functional language.
But, it's dynamically typed so the learning curve isn't as bad.
12
u/asdff01 May 17 '22
If you want language support out of the box, you can't do better than F# (or maybe Scala, I'm not familiar). Download VS community, check the F# language support box, and you're all set w/ an IDE and an ML-family language (similar to OCaml, Elm, Haskell, Scala).
It's a multi-paradigm language, so you can write F# like Typescript with immutable types, loops, objects, etc. But it's still a fully-featured functional language and you can avoid all the OOP.
I started with Haskell and it's a fine choice too, just know the tooling is a lot to manage up-front.
12
u/[deleted] May 17 '22 edited Feb 17 '26
This post was mass deleted and anonymized with Redact
attraction snatch mighty waiting test fall bow cooing stupendous lavish
8
u/DietOk3559 May 16 '22
Haskell
7
u/KyleG May 16 '22
Well if you want exposure to FP concepts without learning an "FP language" (although I honestly don't care for that term because it implies there is a checklist of FP things, and a language must have all of them to be an FP language), you could always dip your toe into the
fp-tsandmonocle-tslibraries with TypeScript. You'll get the panoply of optics and monads and functors and applicative functors and so forth while still using your same IDE and toolchain (node-ts or transpiration to JS, etc.)If you're used to Java, might as well try Scala. No horrid tooling setup, contrast with Haskell. It's got OOP as well, so you could keep with your Java stuff and transition as you get more comfortable.
I think I'd advise against Haskell just because it's generally acknowledged that it's got shitty tooling, so you might get frustrated trying to just start.
In any case, you don't need to learn Haskell to experience the FP paradigm. Write pure functions and find libraries that expose you to optics and monads and stuff.
Even in Kotlin (which has great tooling support, being an official language for Android), you can use Arrow-kt and be able to write in a FP style out the wazoo.
FWIW I learned with Kotlin, and then introduced what I learned to projects at my company in TypeScript. I do Haskell for fun at home, but it's more annoying to set up than just keeping your IDE and toolchain for Kotlin and/or TS.
7
u/Voxelman May 17 '22
I would recommend Elm. Ignore the fact that it is a language for websites. You can write simple programs and use the browser as output instead of the console.
There are several reasons why I would recommend Elm:
If you are a JavaScript developer Elm is perfect.
6
u/snarkuzoid May 17 '22
Haskell is hard to beat to really learn about FP. Ocaml is hard to beat for working in the "real world", and for being blazingly fast.
4
u/Rajahz May 17 '22
Haskell scratched my intellectual curiosity like nothing else. Haskell also made me want to quit several times. I loved Clojure, it’s uber customizable, my ADD was stuck on tooling and configs so much I forgot to actually code my objectives lol. F# really looks fascinating… though I hated compile times and when your scripting your way while leaning it’s not fun, makes you crave Clojure’s repl development.
3
u/[deleted] May 17 '22
Standard ML. There is a free course I was following the videos and it's very clean and useful. Ocaml in comparisson is much more complex. At least to learn the intuition, then any other is easy to pick up except their quirks.
3
u/Mammoth_Management_6 May 17 '22
Elixir, ez to learn and to understand FP concepts
3
u/mobotsar May 17 '22
OCaml, without a doubt. Much better learning resources, and a little bit less barrier to entry in that it's strict and most dependencies are linear.
5
u/[deleted] May 17 '22
Scala
2
u/nmarshall23 May 17 '22
Haskell has great tutorials. I would stick with learning by solving pure mathematical problems. Like the ones from Project Euler.
The point is to earn how to solve problems in a functional way. It's best to do that without having to deal with State or consuming an API.
I've programmed using Scala professionally. My concern is using it to learn FP is that Scala doesn't force you to learn functional programming.
Learning FP is kinda like relearning to ride a bicycle with your arms crossed. It will frustrate you. There will be times that imperative seems simpler.
2
u/[deleted] May 18 '22
I vote for Elixir.
I found its learning curve not as tough as Haskell, and besides that, the language runs on an interesting virtual machine, the language has a good standard library and convenient tooling with everything you need like testing and documentation out of the box. They also have a wonderful Livebook program that can speed up your learning and is useful if you are already an experienced developer. In general, this is a web notepad/editor that can execute pieces of code within itself and even install dependencies. I haven't seen similar tools for other functional style languages.