News for hackers. Stuff that matters.
Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @07:41AM (#37247688)
Basically, the author's criticism is that the language is too powerful, too expressive, people try very abstract things, tooling is bad and no one cares about the language.

There is something sinister in this - first, in the author's lamentations about bad tooling. Other languages require linters, formatters, static analysers, etc. because the language's built-in features and type system are sub-par. In Haskell, that's not true, so the lack of "sophisticated" tooling is way less painful.

Second, this is similar to the "equalise things by dragging everyone down to the same level"-type of thinking. It "makes maintenance a chore" because the language allows you to be creative and shoot yourself in the foot! Sure, you can have languages like Go where the language is simple and it's hard to write "unreadable" code, but that comes at a cost of being very verbose, and not allowing for an opportunity to write really good code. Basically, enforced mediocrity. "Hard to maintain" is also used as an euphemism for "this is too complex and I can't be bothered to try to understand it" sadly. I find that quite ironic in the face of all the needless complexity in the software industry (just look at k8s, terraform plugins or the web development stack)... I know way too many programmers like that, who argue endlessly about what is the "most readable", which in practice just means to write the most straightforward, laziest, zero optimisation code, and giving themselves an excuse for that. Even if a less-capable language hinders development (either by making things non-verifiable like no proper optional/nullable handling or simply by making the code more verbose and/or less readable) their advocates justify it on the basis of being standard or "best practice". I think Haskell and similar languages intimidate similar people because they can't shrug and say "well the language can't do that" to justify their laziness, but would have to actually make a reason up to why they don't want to write sound, safe and performant programs.

Third, about backwards compatibility.... this is a "damned if you do, damned if you don't" situation. On one hand, you have languages like C++ and JavaScript which are really backwards compatible, and have really sizable drawbacks because of it. Sure, your code will compile in 5 years most likely without changes, but the language as a whole suffers because of it. There should be a place for languages which are ambitious and aren't afraid to break things. Backwards compatibility is simply a design aspect, not some holy commandment you must adhere to all times.

Re:Leaving Haskell Behind by xedrac on Thursday August 24, 2023 @07:56AM (#37247779)
> lamentations about bad tooling

I think it's less about linters and more about basic tooling for toolchains, dependencies, cross compiling, lsp, etc... compare the Haskell tooling to Rust tooling and it's easy to see how deficient it is.

> Backwards compatibility is simply a design aspect, not some holy commandment you must adhere to all times.

It's also something that has enormous influence on industry adoption.

I adore Haskell the language. I use it daily. But I make no excuses for its many shortcomings. I would love to see Haskell prioritize industry needs over academic purity.

Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @08:04AM (#37247837)
Sure, it might help with industrial adoption, but the more you commit to backward compatibility, the more mediocre your language becomes. (You can't really adapt new things if you have to keep everything around.)

What's the point in creating the N+1th generic blub language?

Re:Leaving Haskell Behind by xedrac on Thursday August 24, 2023 @08:21AM (#37247951)
What's the point of creating a language that isn't used? If the goal of the language is to academically research new programming techniques, then fine. Other languages will eventually adopt some of the more useful ideas and industry development will improve because of it.
Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @09:06AM (#37248301)
Not creating something because people don't want to use it is really myopic thinking in my opinion. That's like not creating art because no one buys it. Deliberately aiming for something worse in hopes of public/industrial acceptance is not a good approach IMO.
Re:Leaving Haskell Behind by runeks on Thursday August 24, 2023 @09:54AM (#37248796)
> Deliberately aiming for something worse in hopes of public/industrial acceptance is not a good approach IMO.

It's not "worse", it's a tradeoff between backwards compatibility and fixups. Backwards compatibility is a really useful feature in and of itself, and the question is whether this outweighs the usefulness of all the tiny fixups. In my opinion it mostly does.

Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @10:22AM (#37249076)
I agree with you, it's a tradeoff. I definitely don't want to say that backwards compatibility is not important..... but when you have N other languages priding themselves on that, what is the value add in creating another stagnant but stable language like that?

I think the reason why this is not emphasised more is because breaking compatibility is a visible cost (program broke, time to investigate and fix it) while the pains from maintaining backwards compatibility is an invisible cost. (you can't easily quantify the wasted hours and extra bugs from unintuitive/broken language features) This is kind of a natural consequence of the incentives, so I understand why it happens. I'd be happier if it wouldn't.

Re:Leaving Haskell Behind by mathisfun123 on Thursday August 24, 2023 @07:57AM (#37247781)
> Second, this is similar to the "equalise things by dragging everyone down to the same level"-type of thinking.

> and not allowing for an opportunity to write really good code. Basically, enforced mediocrity.

> straightforward, laziest, zero optimisation code, and giving themselves an excuse for that.

> justify their laziness,

Jesus christ you have so much disdain for such a large set of people. Have you ever considered that you might have a chip on your shoulder about Haskell adoption?

> There should be a place for languages which are ambitious and aren't afraid to break things.

There is - it's research and hobby, not production. Like literally "not afraid to break things" is the antithesis of an industrial language.

Sometimes I wonder if some language communities really are cults. It's the same with Lisp - replace "type system" with "homoiconic" and you have the exact same mantras about ultimate supremacy and "intellectual" superiority. But the proof of the pudding is in the eating and across probably 10 computing devices in my home, not a single one has any Haskell or Lisp programs running on it. Lots of Java, C, C++, Python, Rust, Bash, JavaScript, even Perl (probably) but not a single binary compiled from Haskell or Lisp interpreter to be found. To any reasonable person, that should be a strong signal about the so called "power" and value of their sacred cow.

Put another way: the word language in the concept of programming language isn't accidental and learning a niche programming language is comparable to learning a niche human language - have fun, expand your horizons, but don't pretend it's useful.

Re:Leaving Haskell Behind by jamincan on Thursday August 24, 2023 @08:28AM (#37247997)
> Sometimes I wonder if some language communities really are cults. It's the same with Lisp - replace "type system" with "homoiconic" and you have the exact same mantras about ultimate supremacy and "intellectual" superiority. But the proof of the pudding is in the eating and across probably 10 computing devices in my home, not a single one has any Haskell or Lisp programs running on it. Lots of Java, C, C++, Python, Rust, Bash, JavaScript, even Perl (probably) but not a single binary compiled from Haskell or Lisp interpreter to be found. To any reasonable person, that should be a strong signal about the so called "power" and value of their sacred cow.

Xmonad and pandoc are probably the most heavily used Haskell programs. Not necessarily contradicting your overall point, just exhibiting the two examples that someone might reasonably be expected to run into.

Re:Leaving Haskell Behind by mathisfun123 on Thursday August 24, 2023 @08:32AM (#37248030)
fair enough - i don't use xmonad but i do use pandoc on occasion. in full transparency: it occurred to me that i am familiar with postgrest, though i've never run it personally. still no lisp programs though!
Re:Leaving Haskell Behind by littlestymaar on Thursday August 24, 2023 @12:30PM (#37250907)
Isn't HN written in lisp?
Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @01:19PM (#37251754)
Arc, but I think it counts because it's a lisp-like....
Re:Leaving Haskell Behind by mathisfun123 on Thursday August 24, 2023 @07:00PM (#37255655)
and <looks around> what can we conclude from this?
Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @07:21PM (#37255822)
that lisp is a perfectly usable language for writing cool and usable things :)
Re:Leaving Haskell Behind by mathisfun123 on Thursday August 24, 2023 @08:23PM (#37256286)
what exactly is hn usable for other than aggregating links and text comments?
Re:Leaving Haskell Behind by Pannoniae on Friday August 25, 2023 @03:03AM (#37258942)
If it wasn't an usable and/or interesting thing, you wouldn't use it...
Re:Leaving Haskell Behind by doktrin on Thursday August 24, 2023 @10:32AM (#37249171)
> xmonad

I got rid of xmonad in favor of i3 ages ago - precisely because it doesn't force me to edit a Haskell script just to change a keybinding.

Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @08:02AM (#37247826)
"Jesus christ you have so much disdain for such a large set of people." - Correct. I kind of hate myself too. If everyone is afraid to say these things or afraid to have a disdain for bad things, nothing will improve. Things improve because some people are pissed off enough to do something about it, not by just going along with whatever.

"Have you ever considered that you might have a chip on your shoulder about Haskell adoption?" - No. I barely use Haskell myself. This could have been written about any other language, my opinion would have been similar. I don't have a strong emotional attachment to Haskell specifically.

Re:Leaving Haskell Behind by vaibhavsagar on Thursday August 24, 2023 @09:21AM (#37248438)
I personally use Vim, but Emacs alone is IMO the strongest counterexample to your claim about Lisp interpreters (followed by all the programs scriptable with Guile).
Re:Leaving Haskell Behind by mathisfun123 on Thursday August 24, 2023 @09:24AM (#37248469)
I mean I'm aware of emacs but I am also a vim user so I proudly stand by my claim.
Re:Leaving Haskell Behind by yakshaving_jgt on Thursday August 24, 2023 @04:41PM (#37254265)
Haskell isn't just used for small programs for computer nerds.

Haskell is successfully used in industry, in some cases with billions of users.

https://engineering.fb.com/2015/06/26/security/fighting-spam...

Re:Leaving Haskell Behind by consilient on Thursday August 24, 2023 @08:31AM (#37248027)
> Basically, the author's criticism is that the language is too powerful, too expressive, people try very abstract things

I think this is a bit unfair. The author's criticism is that people try very abstract things and don't stick the landing. And to an extent, I agree, but the problem isn't that Haskell is too powerful, it's that it's just barely powerful enough for too many things. Contra the author, GADTs are not one of those things, and snoyman can pry them from my cold dead hands. But singletons clearly are. So are impredicativity, open type families, type level arithmetic, and to some extent Template Haskell. Idiomatic Haskell practically writes itself, but type-level Haskell is at least as hard as C, and it's almost entirely because of how terrible the ergonomics are.

> Third, about backwards compatibility

Strongly agree here, if anything GHC doesn't break backwards compatibility enough. `Num` is an abomination.

Re:Leaving Haskell Behind by jerf on Thursday August 24, 2023 @09:23AM (#37248458)
I think one of the problems that people who get overexcited about functional languages and all the strong typing and such have is that they generally start out in a bad place. Imperative programs with every flaw in the book, threading by locks, for loops that try to modify the index mid-loop, mutation running rampant, all the bad things they complain about. I've worked in those code bases in industrial contexts, they can be nightmares for sure.

So they discover functional programming, and they just get hammered with so very many different ways of doing things. At first it all seems impossible, but then it slowly unlocks itself, and look! All the problems with imperative programs went away! You didn't even properly perceive them before, but they're gone.

You can't hear me, so my tone here is completely serious. I strongly recommend any professional programmer spend some time with a language like this and attain enough fluency to write real, non-trivial code in it, not just map a few lists and maybe use a monad or two. Get something that hits the network or something.

And the problem is, too many of them stop here. Conventional programming sucks. Functional programming rules. Anyone who doesn't use functional programming languages is a loser still wandering blind in the wilderness.

However, there are in fact a lot of practical problems with functional programming languages too, many in the original blog post, others expressed elsewhere. It can be as simple as, that critical library I need is not available in my obscure niche functional programming language, but alas, in the real world, that's enough to be a determining factor.

Where the religious-level advocates of FP lose contact with reality is that there's a third option: You take what you learned in the functional programming world and come back into conventional languages. And I don't mean "use a few maps and jam a monad in to your language even though it completely fails to fit"; that's actually still completely missing the point of functional programming. I mean, you start writing "conventional" code except you pay attention to mutation. You may not write completely pure code everywhere, but the more you mix in the more characteristics of pure code, the more of the benefits you get. (I do think there's an interesting discontinuity at 100% pure, when you can 100% count on it and then build further on that ability to be sure all code is pure, but you do still get a gradient of benefits the more purity you put into your conventional code.) You pay attention to side effects and start isolating them into units instead of mixing them in. You learn how to multithread with messages instead of memory sharing and locks. You don't drag in inappropriate APIs from a foreign paradigm; you take the fact your eyes were opened, and you write code with those now-opened eyes.

And it is not perfect. You will still occasionally have the original imperative problems. But you will have radically, radically fewer of them, so few that the cost/benefit analysis of using the super-strong stuff becomes very difficult to justify, especially over the advantages of being able to use that library you really need. (And see the library has a mutation problem and wrap it in a way that solves it for you, instead of letting it drag the rest of your code base down, etc.)

I have ridden the mighty moonworm... errr... I have fiddled with the Haskell type system and done some interesting things with it. But by and large they really weren't worth it, not in the sense that they don't solve some problem, but in the sense that back in the conventional programming world, I really don't have those problems anymore. No credit for solving problems I don't have.

This is where I diverge with people complaining about not using functional programming. They are comparing writing imperative crap with writing pristine functional code. In this context I don't deny I'd take the functional code too. But I am comparing writing eyes-open conventional code with writing normal functional code. In this context the advantages are a great deal more muted and it isn't anywhere near the day-or-night level of difference... and I gotta say, pitching me back on full-on functional programming by claiming I just don't get it and I just want to write bad code and enable bad code and in general be lazy and bad is bad advocacy in almost every possible sense of that term.

Re:Leaving Haskell Behind by consilient on Thursday August 24, 2023 @10:20AM (#37249057)
> And it is not perfect. You will still occasionally have the original imperative problems. But you will have radically, radically fewer of them, so few that the cost/benefit analysis of using the super-strong stuff becomes very difficult to justify, especially over the advantages of being able to use that library you really need.

This has unfortunately not been my experience. Working alone, sure, I can write acceptably pure code in a conventional language. But generally the issue isn't what I can do, it's what my coworkers will do. Even if almost everyone manages to maintain strict discipline without the support of the language, it really only takes one "productive" cowboy to create a disaster. The biggest advantage of pure functional programming is that taking the path of least resistance produces code that's still sort of ok.

Re:Leaving Haskell Behind by behnamoh on Thursday August 24, 2023 @10:28AM (#37249132)
This is amazing! Thank you for writing it. Maybe you should write a blog or something.
Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @10:29AM (#37249144)
I apologise for the comparison, as your thoughts are very well-structured, and in my head it almost sounds like an insult. But this kind of thinking ("more discipline minimises the problems related to suboptimal languages") is kind of like Uncle Bob's test-zealotry - i.e. you don't need static typing/AOP/linting/any kind of bug-reducing feature, because you can just write more tests (even if it's painful or spurious)

Sure, it is possible to be very disciplined, avoid messy control flow, be careful with mutation, etc.... then good luck trying to get everyone else to get on board with a very niche coding style, unless if you have the strict authority to enforce it. Sadly, in most cases you don't, so you are stuck with the non-verifiable madness.

In an ideal world, this would work - but in an ideal world, we would also be using better languages with way better guarantees and compile-time checks.

Re:Leaving Haskell Behind by jerf on Thursday August 24, 2023 @02:41PM (#37252916)
I don't really get your point, other than trying to insult everyone. It's fairly well established that in the real world, strict functional programming languages aren't an option. So who really cares that you keep railing on about them? Until they're an actual option, we are not being "zealots" when we can't use them... not "refuse" to, can't... and, yes, you're just being an insulting jerk with no real options to offer anyone.

If you want to be wistful for a world where we could use better languages... get in line. It's a long one. But stop expressing it in the form of insulting other people.

You are not the smartest in the room, you are not the only one who has grappled with the issues, and if you'd stop going out of your way to insult everyone else, maybe you could listen to and learn from people offering solutions. Even if they aren't perfect; it's hardly as if you're offering a perfect one either.

Re:Leaving Haskell Behind by yakshaving_jgt on Thursday August 24, 2023 @04:46PM (#37254312)
> It's fairly well established that in the real world, strict functional programming languages aren't an option.

This just isn't true.

We write essentially 100% Haskell where I work. All day, every day. Have done for years.

We have a "real world" business, with real customers, who pay real money.

Re:Leaving Haskell Behind by Pannoniae on Thursday August 24, 2023 @07:32PM (#37255922)
Sure, but if we are talking about a place where let's say functional programming is off-limits entirely (note that I wasn't strictly talking about functional programming in my previous posts; I was talking about anything, any paradigm or tool which helps write more sound, more provable, more stable and less buggy programs)... then the "discipline yourself and enjoy the benefits of FP in less capable languages" will not work either, because in that place, they clearly don't recognise the benefits, the language doesn't encourage it either, so they'll just write the average code as usual.

I am not insulting people personally, I am insulting the "worse is better" culture which is prevalent in the profession. No one has an immutable opinion about this, and I do not think that looking down upon an opinion or set of beliefs is a hostile thing. In a (slightly weird) way, it's actually constructive because it might plant a seed of thought in people that it's possible to do better. I'm doing the opposite of looking down at or insulting people here - I am assuming they are rational and capable of thinking, they just haven't encountered a different mindset than the prevalent and trendy one, and that's a perfectly fine thing.

"Developing/using better tools, languages and trying to change developer culture" is a solution. Sure, not a silver bullet or something achievable quickly or easily, but on a smaller scale, it's definitely possible to achieve success.

Re:Leaving Haskell Behind by AnimalMuppet on Thursday August 24, 2023 @08:57AM (#37248221)
Some programs live for decades. Some programs get worked on after the original authors are gone. Code is written once, but (if the program is worth keeping) read many times. Optimizing for "easy to write" is optimizing the 10% and ignoring the 90%. Optimizing for "easy to read and understand by someone who is not the original author" is critical for important, long-lived programs.

It's not "laziness". It's understanding that maintaining software long-term is a really significant problem.

Re:Leaving Haskell Behind by HelloNurse on Thursday August 24, 2023 @12:27PM (#37250861)
Even when the maintenance is short term, there is also optimization for making the expected type of changes quick and/or easy to perform, something that appears particularly hit or miss with language specific problems: having to fit monad square pegs into typeclass round holes when two libraries need to be used together, unexpectedly needing a significant increase of sophistication and/or boilerplate to support a generalization that should be small, finding a compromise between conflicting preludes or incompatible extensions.
Re:Leaving Haskell Behind by erik_seaberg on Thursday August 24, 2023 @12:46PM (#37251199)
The thing to optimize for is letting experts communicate with each other clearly and concisely. I’m only going to be a newcomer to a system for a short time, and any work while I'm ramping up is not going to be very valuable.
Re:Leaving Haskell Behind by ceddiexd on Thursday August 24, 2023 @11:01AM (#37249611)
Why use a programming language at all? Why not write everything in machine code for that matter?

The point is that Haskell's position on the abstraction spectrum is no less arbitrary than that of Go or C++. You cannot divorce the relative advantages and disadvantages of various levels of abstraction from the realities of maintenance, development time, readability, complexity, and yes, the fact that not everyone is as big brained as you, because by not writing machine code, you have already acknowledged that these realities matter.

I can just as easily come up with my own programming 'language' where there's a 1-to-1 mapping between a countably infinite set of characters and every unique Turing machine. Want to write a program? Find the right character. This is the most terse, most elegant programming language ever, but clearly helps no-one.

The best abstraction is the one that is the most universally understood.

Re:Leaving Haskell Behind by bigbillheck on Thursday August 24, 2023 @11:17AM (#37249828)
> Sure, your code will compile in 5 years most likely without changes,

Five years goes by a lot faster than you might think.