r/functionalprogramming • u/TheLordSet • Apr 28 '24
Question Which Functional Language with strong typing to learn?
My background:
I'm a software engineer working a dayjob with Web development, using essentially just TS for everything
As a side project, I'm working on a game for which I'm using C#, GDScript and a markdown language we're creating called SPML
I've dabbled in some other languages, like C, C++, Rust, Ruby, Java, Python, and some others, but never really got deep into any Functional Programming language.
Recently I've started to learn about Clojure - I'm enjoying it, but I'm feeling the lack of types; coming from TS and Rust, which are my favorite languages so far, it feels so clunky to write anything without types. In Rust and TS I can hover over parameters and variables within functions and know immediately what they are; I hover over functions and I know exactly which type they return, what they take in, etc, and if I try to use something in an awkward way, the compiler lets me know immediately
What I'm looking for:
Essentially a popular strongly typed FP language, that can be as expressive as Clojure. I just want to learn it for myself, not really for looking into jobs, but popularity is important due to availability of packages and learning material. I really liked that on Clojure, but I'm not sure I'll continue learning it after finishing the current book due to the lack of typing
EDIT: Thanks for all the suggestions, everyone!
I'll probably stick to Clojure for a bit after hearing about Babashka; then I'll learn either F#, Haskell or OCaml
41
u/TempusNemini Apr 28 '24
Take a shot with Haskell. It'd be an interesting experience for you. Also you can look at Scala, but Haskell is a better choice for learning fp IMHO
28
u/eddiewould_nz Apr 28 '24
F# would be the obvious choice for interop with your C# game work (Unity etc)
17
u/[deleted] Apr 28 '24
https://haskell.mooc.fi
8
u/strongly-typed Apr 28 '24
Haskell, OCaml, F#
Pick your poison, they’re all excellent choices.
11
u/2legited2 Apr 28 '24
F#
5
u/avillega Apr 29 '24
I am surprised no body has mention purescript. Is like a smaller Haskell with all the nice extensions as part of the main language. Easier to learn and get into in my opinion.
14
u/rlDruDo Apr 28 '24
8
u/uppercase_lambda Apr 28 '24
If you're using Godot, you should check out F#. It works basically okay with Godot and Unity.
It'll also be an easy transition to ML-like languages
3
u/[deleted] Apr 29 '24
Rust
3
u/TechnoEmpress Apr 29 '24
Haskell!
5
u/effinsky Apr 28 '24
Gonna have to be Haskell, ocaml or scala huh?
4
u/downrightcriminal Apr 28 '24
I'd recommend Haskell, it revolutizined how I thought about programming when I first learnt it. Once you learn Haskell every other FP language should become very easy to pick up
7
u/Previous_Pop6815 Apr 28 '24
The Scala course by Martin Odersky, the author of Scala, is an excellent introduction to functional programming. It is also well-balanced, which is beneficial since it is used in commercial environments as well.
https://www.coursera.org/learn/scala-functional-program-design
2
u/mister_drgn Apr 28 '24
As a fairly experienced Clojure programmer, I’ve recently been playing around with statically typed functional languages. Haskell is an obvious choice, but I went with ocaml (for now) because it’s less militant about side effects.
2
u/Tempus_Nemini Apr 29 '24
Haskell.
P.S. And you get Monad joke for free :-) Unless you realize that it's not a joke at all (which is another recursive joke, so to speak)
2
u/Positive_Total_4414 Feb 27 '25 edited Feb 27 '25
How come Lean hasn't been mentioned?!
Also, FStar is a good one, missing from the answers.
Unison is still young, but take a look at their language introduction videos, might blow you away a bit.
I used to program Clojure a lot, and it was great, but if you want to have types there, you will have to find a way to enforce them, like with TypedClojure, etc. You might find this post by a well-known Clojure contributor quite interesting. Also you might try combining Clojure+Scala or Clojure+Kotlin and get some cool stuff, but you're deep in the weeds by then.
Today, sadly, lisps don't satisfy my typing needs. There's Coalton though, but I have barely tried it yet. I still program in lisps from time to time though :D
2
u/entropyvsenergy Apr 29 '24
Julia is typed and functional, but has more applications to scientific computing than systems programming I think.
5
u/GunpowderGuy Apr 28 '24 edited Apr 28 '24
I really recommend idris2. It's a dependently typed language with totality checking and theorem proving. The rich type system can be used for meta programming and preventing bugs. It's also beginner friendly because its got a greatly helpful community and avoids all of the technical baggage of Haskell
3
u/_nathata Apr 28 '24
Good old Haskell
1
u/julienlucca Apr 29 '24
how come Gleam wasn’t mentioned?? Awesome language, small footprint, easy to learn and has interoperability with the BEAM and Javascript natively. Awesome timing as well, easy to make your name
7
u/[deleted] Apr 28 '24 edited Apr 28 '24
[removed] — view removed comment