Hacker News new | ask | show | jobs
by msla 1316 days ago
Is Scala meaningfully more mainstream than Haskell?
2 comments

Of course it depends on whom you ask.

But at least the usual programming language rankings would suggest that Scala is quite mainstream by now.

We have it currently at place 15 on RedMonk, place 15 on the IEEE Spectrum ranking, place 19 on PYPL; whereas Haskell does not show up in the Top20 anywhere there.

Also Scala job opportunities and salaries are quite good when looking at the IEEE and Stackoverflow surveys, ranking quite a bit ahead of Haskell.

I would say Scala is pretty much a mainstream language. There's not much room in the Top20 given there are hundreds of languages out there.

Yep, I've had multiple scala roles, no haskell roles yet.

Still, scala has always been promoted as being easier to learn (more like Java?) and being on the JVM, rather than winning on its own merits. So kotlin will probably eat scala.

One of the problems around Scala is that people come in with an expectation that Scala would be like Java. No, it isn't. It's a whole different language. It's much more similar to OCaml (besides the syntax, of course) than it's similar to Java.

Kotlin is only competition in the "better Java" space. But that's more or less quite a small part of Scala. Scala starts to be an interesting language in its own regard beyond this point. Kotlin OTOH does not even offer comparable features. So it can't replace Scala where Scala shines.

I would say that in the long run it's Kotlin that's "in danger" as Java becomes more and more a "better Java" itself. There is not much stuff left in Kotlin these days (besides the nicer syntax) that is still missing in Java. And it gets less with every Java release. As Kotlin, mostly "just a better Java", has not much to offer besides some syntax sugar it will have a hard stand against a future Java, imho. Scala does not have this problem as people mostly given up using it as a "better Java", or migrated to Kotlin (or even back to Java) for this purpose anyway, and are using it now in a more idiomatic way that can't be simply replaced by any "better Java".

Regarding simpler: That's for sure a strong point in favor of Scala compared to Haskell. Scala 3 is on its surface not more complicated than Python, I would say[1]. It's also easier to pick it up gradually, compared to Haskell where understanding even "Hello Wold" will require some understanding of monads.

For people who don't know Scala by now or didn't look into it for a long time: It's one of the better FP languages currently out there, but it won't drown you in alien concepts right form the start. It's easy to pick up. But it's still at least as powerful as Haskell. But more pragmatic and down to earth. It's worth having a look for sure!

The simplest and quickest way to give it a try is installing scala-cli[2], I guess.

Than, for bigger / real projects you would use likely Metals[3] for VS Code / vim, the Scala IDEA plugin, or, for the Emacs diehards, the new Ensime. (Where the Metals experience is imho currently the smoothest).

---

[1] https://docs.scala-lang.org/scala3/book/scala-for-python-dev...

[2] https://scala-cli.virtuslab.org/

[3] https://scalameta.org/metals/

> I would say that in the long run it's Kotlin that's "in danger" as Java becomes more and more a "better Java" itself. There is not much stuff left in Kotlin these days (besides the nicer syntax) that is still missing in Java. And it gets less with every Java release. As Kotlin, mostly "just a better Java", has not much to offer besides some syntax sugar it will have a hard stand against a future Java, imho.

There are two things that I miss any time I try to go back to Java from Kotlin, and recent improvements haven't helped matters:

1) Null safety. Java has Optional now, but most of the standard library still may or may not return null, and you have to read the javadoc to find out if you should be handling for null.

2) The collections library. Kotlin has the most comprehensive and consistent collections library I've ever seen in any statically typed language; it's comparable to Python in expressive power. Java doesn't even come close.

The features that Java has adopted (sealed interfaces, records, etc) are nice, but not the core of why I use Kotlin.