Some people love it, because it potentially gives you an enormous amount of leverage to solve difficult problems with careful but short solutions. I forget where I heard this joke, but you give a Java programmer some specs and he'll spend 4 hours writing code, whereas the Haskell programmer will spend 3 hours and 55 minutes meditating, then write a 10 line solution.
The counterpoint is all that abstraction is often just needless busy work, that more often serves to feed the programmer's ego rather than accomplish real work. It's also not pleasant trying to figure out compiler errors that you need a PhD in abstract algebraic topology to understand.
I prefer the "meditative" approach, because it will more often produce something readable. It looks unproductive, because there is a small number of lines produced in a given amount of time, but that's actually good. With the approach where the programmer just sits down and bangs away at the keyboard straight away, producing lines of code at uniform velocity, you end up with loads of code doing nothing, "dowork", calling "doworkimpl", stack traces 50 stack frames long where no stack frame seems to be doing any useful work. The "meditative" approach in extreme cases can produce indecipherable code with y combinators and whatnot, if your coworker is a real monk, but generally brevity seems to be a nice benchmark. All those great Haskell abstractions don't actually produce short code, it's the basic Haskell that does it. It just takes a while to arrive at such a solution, be it C or Haskell. And it's a win long-term, when you need to get back to this code to debug it. And you are going to need to get back to debug it.
See e.g. The Evolution of a Haskell Programmer[1]. It's not the great abstractions that produce the shortest code. But it is the shortest code that is the clearest.
[1]: <http://pages.cpsc.ucalgary.ca/~robin/class/449/Evolution.htm>
- Pablo Picasso
Haskell encourages very simple but highly abstract abstractions. Scala, I would agree, tends high complexity as well high abstraction level.
Both can be barriers to understanding if one is not familiar with the particular abstraction, but they are different issues (high abstraction level tends to be something you go from not getting intuitively to getting intuitively in a phase transition, while high conplexity tends to be more gradual and has a greater irreducible cognitive load.)
They encourage highly simple abstractions. You can put functions like `fromString` and `map` onto interfaces. No need to go via builders/generators/collections.
Dijkstra said it best: "The purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise."
I'd much rather deal with that and become better in my profession than being woken up at night because something is on fire at runtime and I have to jump in and understand it, fix it and clean up after it.
Given the choice of reviewing and maintaining one versus the other, I’ll take unwashed Java code any day. I’m not a fan of enlightened, esoteric solutions.
Also something that is beautiful is not necessarily esoteric (though esoteric isn't really meaningful anyways. Chinese sounds esoteric to me just like English sounds esoteric to others).
But it really comes down to experience, not the qualities of the language. A professional in both Java and Haskell would most definitely prefer a few line Haskell solution vs a massive Java solution. Just like they would prefer a few line Java solution over a massive Java solution.
I would posit it's unlikely that the same people both love and hate them. My guess would be we're seeing the OO-FP divide in action. If F# or Elm were more popular, they might be on both lists, too.
In fact, if you interpret it liberally, JavaScript might be considered FP by some takers of the poll, given browner JS codebases (pre-await) would need continuation-style approaches. Obviously, JS has other [reputation] problems, too.
To put it another way, Haskell's had a great story around IO for 29 years, or longer than Java's been around.
All the modern future/io/concurrency frameworks have followed suit. We construct objects representing computations and we flatMap them together, which is all the IO monad is. Although for some reason the syntax from last millennium hasn't made it into the modern languages:
str1 <- readFile file1
str2 <- readFile file2
let str3 = str1 ++ str2
writeFile file3 str3
vs: readFile(file1).flatMap(str1 -> {
readFile(file2).flatMap(str2 -> {
String str3 = str1 + str2;
return writeFile(file3, str3);
}});
[1] https://www.haskell.org/ghc/docs/papers/imperative.ps.gzI like that a lot. I did not realize that problem was solved so early on.
The things I was thinking of were more like good application frameworks, database libraries, etc. all the stuff you need to build commercial products and that you might have trouble justifying developing on an investor’s/shareholders’ dime.
That is a tall claim. LazyIO has been problematic in Haskell well into the 2010's until Iteratees became well-understood.
From Oleg Kiselyov's 2012 paper Iteratees [1]:
Lazy IO is so irresistible that it was added to Haskell
despite the reservations of its inventors and the failure
to develop good techniques for reasoning about its correctness
[7, Sec 10.5]. However benign, reading is an observable
side-effect, whose occurrence may have to be correlated with
other side effects. Such correlations are crucial when
performing IO over communication pipes, which is typical of
web servers.3 As Launchbury and Peyton Jones feared, Lazy IO
indeed "gives rise to a very subtle class of programming errors".
We have seen deadlocks; mishandling of IO errors; running out of
file descriptors and similar scarce resources; unpredictable,
volatile and sometimes unbearably excessive use of memory. We
illustrate the splendors and miseries of Lazy IO in §2.
This is a very famous Haskell programer's opinion on the default IO in Haskell, and he quotes that one of the main creators of the language himself anticipated such problems [2]. Why downvote a comment in 2021 challenging the claim that "Haskell's had a great story around IO for 29 years"?[1]: http://okmij.org/ftp/Haskell/Iteratee/describe.pdf
[2]: https://www.microsoft.com/en-us/research/wp-content/uploads/...
Long running processes handling lots of different requests, not so much, and that's made up an increasing amount of what people want to do.
But for "open a file, chew through it, errors when consuming it might as well take down the process" nothing could be easier.
I've used conduits before, and understand that pipes fit the same design space.
But most of the time I just use read and write operations exposed by Bytestring, etc.
My point is that since I like IO today, and I didn't think that laziness had been removed, then I probably would have liked IO back in the day.
The operations provided by `Data.ByteString` do not work like this; the ByteString you get back represents a buffer, and it has already been processed by the time the RHS of >>= starts executing.
The operations provided by `Data.ByteString.Lazy`, on the other hand, do work like that; the ByteString you get back is a linked sequence of buffers, and some of those links might be thunks to go get the next bits of the ByteString for you.
This is why a Data.ByteString.ByteString and a Data.ByteString.Lazy.ByteString are different types, and you can't just pass one where the other is expected (unless you've abstracted over it) - they're actually shaped differently.
My working hypothesis, not incompatible with yours or the article's, is that familiarity breeds contempt.
There are people out there who want the absolute best language for a project, even if they don't already know it.
Then there are those who would be annoyed at having to learn a new language and all its quirks to do something that Java could have done, even if it cost more in servers or requires more lines of code.
Scala and Haskell are distinctly non-C-like. Both are functional languages with types. Maybe that is a factor.
Actually, in a new project that wouldn't be "low-level" work on e.g. operating systems, drivers or high-throughput networking software I would strongly suggest using Clojure/ ClojureScript. The net productivity, onboarding speed and efficiency are great. Both are quite performant as well and integrate into the Java/JavaScript world with ease, so there are libraries and tools present. Using babashka or the Node.JS target for ClojureScript could be great for scripting as well, although Python or Hy (Clojure on top of Python basically) are strong contenders because of libraries.
On top of this, lots of companies started using Scala because Java hit a long period of stagnation. So these companies have a mix of Java/Scala and a primarily Java developer - that likely doesn't like kitchen sink languages - may be required to maintain a Scala program from time to time.
Yes, that can also cause a mess, but for learning it is one of the best languages out there imho.
Could be that once you really grasp them, you love them, but they’re harder to grasp because they’re so different?
One possible explanation (that supports the author's main thesis) would be that three out of five of these are unlikely to be the main language for a project, but rather a supporting language. In other words, SQL and shell are just as likely to show up in a green-field project as in a brown-field project, because we still use SQL to communicate with database same as 20 years ago, and we still use shell scripts to tie it all together.
No idea how one would test this hypothesis, however. And I still don't have an explanation for why Scala and Haskell are both loved and hated.