DEV Community

Cover image for Functional-programming tier list
Zelenya
Zelenya

Posted on

Functional-programming tier list

šŸ“¹Ā Hate reading articles? Check out the complementary video, which covers the same content.


If you have ever wondered which functional programming language is better than others, which one to pick, or which to learn ā€” here is my subjective tier list.

āš ļøĀ Note that Iā€™m a bit biased towards statically typed languages.

šŸ’”Ā If you havenā€™t seen one of these, we go from D (bad/terrible) to S (the best/excellent).

Haskell

Letā€™s start with Haskell. If you can only take one functional language to the desert island, you should take Haskell because it offers so much. Sure, itā€™s not for everyone ā€” it has a steep learning curve and can feel like throwing someone into the water to teach them how to swim ā€” but it can be well worth it.

Laziness ā€” a major reason to use Haskell, also a major source of frustration. Also, Haskell provides great concurrency mechanisms and powerful type-level machinery with great type inference. All of this has been there and stable for more than 20 years. Nevertheless, Haskell keeps growing ā€” there is always more stuff to learn and experiment with.

Seems fair that Haskell is an S-tier fp language.

Scala

Scala, on the other hand, offers a gentler learning curve and you can dial up the functional programming at your own pace. You canā€™t go as ā€œfarā€ as Haskell, but you can go pretty far.

I have a special place for Scala in my heart.

I think Scala is an ideal fp language for Java developers and has an excellent free course for functional programming beginners.

Without doing any research, Iā€™m pretty sure Scala is the most used fp language in production.

Scala also deserves an S-tier.

OCaml

OCaml is another language that offers OOP/FP flexibility. OCaml 5 was a strong release, which not only brought multicore but also a lot of attention to the language.

When people talk about OCaml, they often talk about a powerful module system, performance, and strong developer productivity (e.g., reversible debugger) ā€” but I canā€™t speak on that because I havenā€™t used it in proper projects. I can talk about my favorite features: polymorphic variants and effect handlers. Polymorphic variants is my current preferred way of dealing with errors, and Effect handlers seem to me like a future of the control flow. Two features I wish every language had (or will have).

Overall, I donā€™t have much experience with OCaml, but S-tier feels fair.

PureScript

Going back to a language I used: PureScript. I think itā€™s highly underrated.

How do I put it? Itā€™s like a tidier version of Haskell ā€” in my opinion, itā€™s easier to learn and get into.

It has a solid interop with the JavaScript world ā€” so, you can slowly introduce it to your project and at the same time have access to the sea of js libraries.

On top of that, PureScript offers great records and row polymorphism. I know I keep bringing this up every time, but any time I have to manipulate some data, especially json, I miss not using PureScript.

Unquestionably S-tier.

Elm

Elm is a sibling of PureScript, and itā€™s even more focused. Itā€™s both focused in the ā€œfeaturesā€ it provides and focused on beginner friendliness. I bring this up in my video on values: itā€™s not for everyone but has a solid niche.

Elm is another great way to tap into fp from the frontend direction.

Because it has clear values and focus, itā€™s a solid S-tier.

Roc

If I understand it correctly, Roc is bringing Elmā€™s values and mindset to the backend. Or at least extending on those.

It has an attractive approach to balancing (or navigating) between prototyping and reliability ā€” they promise a nice flexibility of dynamically-typed languages with a seamless switch to the other mode, where you actually handle both happy and error paths.

šŸ’”Ā I donā€™t have time to get into this, but if this sounds vague but exciting, Iā€™d recommend looking into it (either watch a full talk on this or actually try it yourself)

On top of that, I think their anonymous sum types look fun (together with all the open and closed records and unions). And Iā€™m also curious where their ideas around different platforms are going to lead.

Roc doesnā€™t have a ā€œstableā€ release yet, but I say itā€™s an upcoming S-tier.

Unison

Unison is another new kid in town. And I think Unison can compete with Haskell on an amount of mind-breaking concepts. I donā€™t even know where to begin. Two of my favorite things:

1) Everything is a function: deployment is done with a function call, calling another service is a function call, and accessing storage is a function call.

2) Abilities ā€” Unisonā€™s implementation of direct-style algebraic effects, similar to OCamlā€™s effect handlers.

safeDiv3 : '{IO, Exception, Store Text} Nat
safeDiv3 =
  do
    use Nat / == toText
    use Text ++
    a = !randomNat
    b = !randomNat
    Store.put (toText a ++ "/" ++ toText b)
    if b == 0 then Exception.raise (Generic.failure "Oops. Zero" b)
    else a / b
Enter fullscreen mode Exit fullscreen mode

Did I mention that they promise to eliminate yaml? S-tier.

Gleam

Gleam had a v1 release a couple of months ago. Itā€™s a friendly language on top of Erlang runtime. Itā€™s a simple selling pitch, but quite a strong one.

And they have the sweetest mascot. What other reasons do you need? S-tier.

F-sharp

Once again speaking of interop, F# might be an obvious fp choice for those on the .NET: either youā€™re using C# already or want to make games using popular engines.

And I keep seeing people bringing up F# for Fun and Profit ā€” it looks really fun.

I havenā€™t touched F# ā€” Iā€™m a bit biased. So, S-tier.

Takeaway

As you might have guessed Iā€™m pretty excited about functional programming. There are a lot of options, targeting different platforms, audiences, and values. Just pick your poison.


Top comments (2)

Collapse
 
giullianosep profile image
Giulliano Ferreira

What are the characteristics of a functional language? It's an honest question. It seems to me these days that the line separating FP from OOP languages is blurred. I mean, I never thought of Scala being an FP language, but I don't know the language well enough, it looks very OOP to me. But I've seen people mentioning Scala, Rust and Swift as functional languages as well. I don't know anymore. :D

Collapse
 
zelenya profile image
Zelenya

Ask 10 people what functional programming is and get 7 different answers.

After that ask if pure functional programming is different and make it even worse.

There is no one functional programming and there is no good definition of either term.

I useĀ functional programmingĀ (andĀ fp) as an umbrella term for the assortment of concepts and values. I also share my thoughts on core ideas found across the primary fp schools of thought, even if they get different emphases and come in various forms (some are more universal, while others are more prominent in specific communities).


Imagine FP is like whiskey. Of course, there is a significant difference between an archetypical Isles whiskey and an archetypical Irish whiskey. Of course, some people got mad at the ā€œwhiskeyā€ spelling instead of ā€œwhiskyā€. The point is, that some essentials make whisk(e)y different from beer. And this is what it's all about.