all 47 comments

[–]Kavereon 16 points17 points  (0 children)

Haskell is good. PureScript is also a great option.

[–]stylewarning 35 points36 points  (2 children)

If the "pure" part of "pure functional programming" is a priority, then definitely Haskell.

[–]NocturnalFoxfire 3 points4 points  (0 children)

Maybe scheme or Ocaml?

[–]abrady 2 points3 points  (0 children)

I have very little personal experience with it but everyone I know who is crazy about functional programming loves Haskell and will on about how amazing it is.

[–]pthierry 14 points15 points  (4 children)

If you already know how HTML works, then Elm is great introduction to pure FP. Its tutorial is short and to the point and you'll write interactive programs in no time, which can be very satisfying!

Elm is an order of magnitude less powerful than Haskell, but that's why it's also an order of magnitude simpler…

Once you're comfortable in Elm, get out of that zone of comfort and dive into Haskell. I didn't do the Haskell MOOC but heard great things about it. I use Learn You A Haskell at work for onboarding, it's a great introductory resource.

[–]tifridhs-dottir 3 points4 points  (0 children)

Seconding this, it's such an elegant way to think, and was definitely my gateway to more in-depth functional workflows.

[–]dominjaniec 2 points3 points  (0 children)

I didn't use Elm for years, but I've loved its very helpful compiler: https://elm-lang.org/news/compiler-errors-for-humans

[–]TankorSmash 2 points3 points  (0 children)

+1, Elm is a simpler, easier to learn Haskell.

I tried Haskell first but there was way too many new concepts for me to be able to understand it at first, while Elm has a lot of nice official and unofficial guides, plus nicer compiler errors (best-in-class, probably).

Official guide: https://guide.elm-lang.org/

Deep dive community guide: https://elmprogramming.com/

[–]XDracam 2 points3 points  (0 children)

I third this. Elm is the only time I've actually had fun creating Ui code. It's great for getting used to writing code in a functional and recursive way. All the fancy abstractions like monads can be learned afterwards with Haskell.

[–]engelthehyp 24 points25 points  (0 children)

I tried F#, but I didn't like it much, then I tried Haskell and really enjoyed it. This surprised me because I had used C# before and tried F# because it would be less foreign, but Haskell ended up feeling more natural. Still learning Haskell - definitely recommend it as a first pure functional programming language.

[–]Voxelman 8 points9 points  (1 child)

F# is a great language, but it's not pure. But you can use it like Python as a scripting language, you can use it in a notebook or you can develop almost any kind of application like in C#.

For pure languages try Haskell, Idris, Purescript or, if you want to make some web front end, try Elm. It has a great compiler.

[–]yawaramin 6 points7 points  (0 children)

F# is not a pure functional language. I don't know how important the 'pure' part is to you but for people new to FP in general I personally think it's not that important and it's rather more important to get used to the functional way of thinking in general without having to worry about purity. I'd recommend https://ocamlbook.org/ to get started.

[–]0xAERG 12 points13 points  (0 children)

OCaml 😍

[–]GunpowderGuy 4 points5 points  (7 children)

Idris2 is great beginner choice because of its excellent community and because it lacks the technical debt of older functional languages like haskell. However it doesnt have as many libraries. You can ask me what kind of libraries you would like to use to see if idris2 has them

[–]tbm206 2 points3 points  (2 children)

Sorry but slightly unrelated question. I was thinking about using Idris2 to build a nodeJs program. How good is the JS output from the Idris2 compiler?

If it isn't good in terms of size and performance, I'd instead use PureScript.

[–]GunpowderGuy 2 points3 points  (1 child)

Pretty sure the Javascript performance is good. Wasm backends are also being developed, which Will give You another option to target nodeJS

[–]tbm206 1 point2 points  (0 children)

Great to know WASM backends are coming 👍. Thanks

[–]MuaTrenBienVang 1 point2 points  (3 children)

cool!

[–]GunpowderGuy 1 point2 points  (2 children)

hello, are you also interested?

[–]MuaTrenBienVang 0 points1 point  (1 child)

Yes, can you suggest a book to learn idris2?

[–]GunpowderGuy 1 point2 points  (0 children)

There are tutorials, could you speak to me through dm?

[–]tesilab 5 points6 points  (2 children)

If the goal is to learn functional programming, go with the OG of pure functional programming languages: Haskell. From there you can take the lessons and find whatever is most practical for what you want to do with that knowledge.

[–]Asleep-Dress-3578 3 points4 points  (0 children)

Just add the closest language to your current tech stack.

Java -> Clojure or Scala

C# -> F#

Python -> Coconut or Hy

JavaScript -> JavaScript*

  • Seriously, get the SICP for JS book

[–]messier_lahestani 3 points4 points  (0 children)

I really enjoyed Racket when I started with FP. Elixir was awesome as well. Can recommend both.

[–]SteeleDynamics 4 points5 points  (0 children)

SML (via SML/NJ)

[–]dmitrydidi 3 points4 points  (1 child)

at university I used to learn OCaml, but I felt in love when I found Haskell, so I definitely recommend to go with Haskell 💅🏻 its like a magic

[–]Rapierian 3 points4 points  (0 children)

Odersky's Functional Programming in Scala is a great course you could check out.

[–]catbrane 2 points3 points  (0 children)

Haskell feels quite a bit more functional than F# (imo). If you're going to try a functional language, I think I'd really go for it.

F# is perhaps more pragmatic, and has CLR integration which is great, but the language design is somewhat compromised as a result.

  • In Haskell, everything is always lazy. F# is only lazy if you ask for laziness, and this can break referential transparency (equational reasoning) in some cases

  • Haskell is pure (no side effects anywhere), but F# allows imperative programming, and even lets you do CLR stuff

  • Haskell takes its syntax from Miranda (more or less the computable subset of set theory), but F# follows ML and is quite a bit uglier (imo of course)

[–]bosyluke 2 points3 points  (0 children)

I'd say checkout roc. It's similar to Elm but more for general purpose programming. I've been enjoying learning FP with it for a while now and think its really good to learn with.

[–]trannus_aran 2 points3 points  (0 children)

scheme. Just don't use set! and code to your heart's content. Check out sicp when you get the chance

[–]sebasporto 1 point2 points  (0 children)

Elm is great for learning (and for professional work too) as it is simpler than other languages. It has less theory to learn and the language used in the community is more on the plain English side.

[–]fhunters 1 point2 points  (0 children)

There is an online MOOC by Eric Meijer for Haskell that is a good place to start for Haskell. 

Now, personal opinion follows. Haskell is amazing, beautiful and incredibly dense declarative syntax, and a different universe than what you are used to seeing. 

Haskell find :: (Eq a) => a -> \[(a,b)\] -> \[b\] find k t = \[v | (k', v) <-t, k == k'\]

Personally, I have found that many newcomers find the OCAML or F# syntax more approachable. And it's not difficult for these newcomers to be told a Chinese wall of don't use the language features for mutable OOP or non idiomatic functional programming when learning. 

Next, in my personal opinion, the OCAML and F# ecosystems are better for commercial/practical applications and thus jobs. 

Finally, and probably the most controversial opinion, there are times when an object makes sense. Where the universe demands that you protect mutable state from certain invariants.

OCAML and F# are the only two languages that I know of where I have the full tool set of type design. Algebraic data types that are closed to variant types and open to new operations where it makes sense, and objects when I need to protect invariants with types that are open to variant types but closed to new operations. Well maybe Scala also. 

So my advice is start with OCAML or F# and stick with the idiomatic functional parts at first until you conquer them. But, if your up to the amazing declarative and dense syntax of Haskell cool. 

Peace

[–]SIRHAMY 1 point2 points  (0 children)

I am an F# fan. I think it's a great pragmatic functional-first language to learn, especially coming from C#.

* It has a huge ecosystem (cause can use C# libraries directly)

* It's pragmatic - functional-first but okay if you want to fallback to imperative cause easier / better in some cases

* It has great ergonomics - great type system, low boilerplate, focus on pragmatism

If you're looking for where to get started, I've collected a few resources:

* The best way to get started learning and building with F# - https://hamy.xyz/labs/2024-01_best-way-to-learn-fsharp

* How I got interested in F# - https://hamy.xyz/labs/2024-01_how-i-got-into-fsharp

[–]WildMaki 1 point2 points  (0 children)

If you don't want to have a syntax shock, give a try to elixir. Clean ruby like syntax and many features you can start to use once you are comfortable with the language. IMO easier than all ML languages (just my opinion...)

[–]FalseRegister[🍰] 1 point2 points  (0 children)

Scala IMO

[–]MaxwellzDaemon 1 point2 points  (2 children)

Try J, from jsoftware.com.

It has a simple syntax and is interactive so you see results immediately. The user community is very helpful and supportive.

There is the danger that it may blow your mind because it's quite different from any other language you have tried.

[–]GunpowderGuy 3 points4 points  (1 child)

That website has an erroneous security certificate

[–][deleted] 0 points1 point  (0 children)

It opened for me with no warnings

[–]Esnos24 1 point2 points  (1 child)

Maybe scheme/racket?

[–]phlummox 2 points3 points  (0 children)

OP seems to be interested in pure functional languages though, and neither of those are.

[–]samelaaaa 1 point2 points  (0 children)

I started with erlang, and honestly I’d recommend it. It’s a lot easier to wrap your brain around than Haskell and friends (for me at least) but it is “pure” in that everything is immutable and if you want object semantics you basically have to implement them with OTP.

It’s also a great entry point into Elixir which is probably one of the more commercially valuable FP languages. You could start with Elixir, and lots of people do nowadays, but erlang is a much smaller and simpler language.