9 ms·
One heuristic for the quality of a language is to literally ask "what is it good for?" Just off the top of my head (I'm skipping a lot of categories and langua
by prohobo 6y ago
One heuristic for the quality of a language is to literally ask "what is it good for?"
Just off the top of my head (I'm skipping a lot of categories and languages):
C/C++/Rust are great for systems programming, games, and performance critical applications.
Go/JS/Python are great for creating web servers, data processing (Python mostly), and small apps/scripts.
Haskell? I have no idea.
- als0 6y agoHaskell: 5 line quicksort and parsers/compilers. I do like the language, though.
- sn41 6y agoActually: in-place quicksort in Haskell is as verbose as in other languages. The 5 line quicksort uses linear order additional space.
- Blikkentrekker 6y agoThe matter with Haskell is that one often doesn't use in-place updates and that the language is designed such that this can be more efficient than in many other languages though Ocaml probably does this better with it's incremental garbage compilation strategy.
- AzzieElbab 6y agoWell, that 5 line quicksort is fake. Haskell is good for writing other languages like Elm for example
- usrnm 6y agoYou can write quicksort in C++ in about the same number of lines using std::partition from the standard library.
- tlarkworthy 6y agoCompilers and logic programming
- Blikkentrekker 6y agoThe advantage of Haskell is obviously that it's very easy to write code that is very bug free compared to most languages. Java and Go are used and Haskell has comparable performance but certainly less bugs.
- Guthur 6y agoThese are just wild unsubstantiated claims. In my experience the worst errors are those of broken referential integrity in distributed systems, misinterpreted product specifications and plain old "this doesn't do what i thought it did" code
- foolmeonce 6y ago"This doesn't do what I thought it did" should have a strong connection to needing to rely on reading documentation made from comments. In some sense that form of literate programming is about limiting the scope of each individual misunderstanding without eliminating any of the misunderstandings.
- UncleMeat 6y agoThe software engineering research community has almost no idea how to measure "ease of writing correct programs". So it becomes very difficult to make meaningful claims that Haskell programs will contain fewer bugs.
- shipp02 6y agoHaskell is born out of academia and PL research so it has a great ability to add extensions to the language. If you have a concept PL feature it is probably easiest to create a prototype in Haskell. A handy guide to its [extensions](https://limperg.de/ghc-extensions/ https://limperg.de/ghc-extensions/) Not much practical purpose for most people but nonetheless a useful feature.
- pea 6y agoBuilding DSLs in finance
- IshKebab 6y agoHaskell is good for transformation type programs, e.g. compilers or document conversion (e.g. Pandoc). It sucks for pretty much everything else.
- anta40 6y agoAs a mobile dev, I don't see much effort in Haskell community working on Haskell toolchain for mobile apps. They seem to more interested in web frameworks. Hmm...
- stingraycharles 6y agoAs far as I understand, Haskell’s original intent was to be like a testing ground for research into functional language design, which I think it really succeeded at. Additionally, I do know of more than a few production deployments of Haskell in finance, but that doesn’t necessarily mean that that is what Haskell excels at.
- Blikkentrekker 6y agoIt's probably quite a good language for “transformation of data” without side effects where correctness is more important than performance.
- stingraycharles 6y agoAs someone who has extensive experience in both Haskell and Clojure, I can say that the latter is definitely better suited for “transformation of data”.
- feanaro 6y agoI don't think this adds much to the discussion. I also have extensive experience in both and I'd argue the reverse.
- stingraycharles 6y agoI think it does, as the OP was asking what Haskell is great at. Clojure actively positions itself as a language great for data transformations, as does the community, where Haskell doesn’t particularly tailor towards this. In fact this is the first time I ever heard someone say that Haskell is a great choice for that. I hear many more Haskellers argue it’s a great language for writing parsers, and with that I very much agree.
- mchaver 6y agoBut positioning as such doesn't necessarily make it true. Just because Haskell isn't advertised as the "data transformation" language doesn't mean it does better or worse than any other language at it. In my personal experience of using Clojure, Haskell and Python for data transformation and parsers, Haskell does the best job for both. So this is the second time you hear it ;) Anyway, we are just throwing anecdata at each other. Personal stories are still useful for programming experiences since "which is better" isn't that easy to measure. I would be happy to hear more about your experiences with Clojure.
- _query 6y agoHaskell is pretty nice for building web applications. Thanks to it's type system you can build much more stable web apps in less time. Usually later in the application life cycle you have a hard time refactoring stuff when working with e.g. JS or rails. Without tests you will definitly break stuff. With haskell you can confidently refactor your code without worrying about breaking stuff, the compiler will tell you. The way data structure are declared in haskell is also very nice for domain modeling. You don't have as much boilerplate as e.g. when using PHP with doctrine. The performance is also pretty good compared to python or rails.
- Guthur 6y agoEmpirically the evidence suggests all those languages without Haskells type system are doing fine considering that the vast majority of the software is not written in Haskell in its actually running. Frankly hiring is just a way harder problem than building a Web app, and fixing JS, Java python or whatever engineers is significantly easier than finding reasonable Haskell engineers.
- ojnabieoot 6y ago> the vast majority of the software is not written in Haskell in its actually running. The vast majority of software has horrible domain and security bugs! I am not one of those people who complains about the bloated state of websites or app stores, but the vast majority of software is not “fine,” especially software written in Python or JavaScript.
- Guthur 6y agoUtter nonsense to imply that Haskell would suddenly fix bad security. Haskell code can have security issues too hidden inside some too clever for it's on good language extension ridden Haskell code. Too be honest I think there is likely only a handful of people like Ed Knett who actually grok and write effective Haskell code, and guess what he'd also write good C++ code as well.
- 6y ago
- kreetx 6y agoMaking other languages feel like they are missing out :).
- zhte415 6y agoHaskell is great for screwing with undergraduates' minds. Box proofs anyone? I did it more than two decades ago and for some reason haven't decided to pick it up again.
- ojnabieoot 6y agoI am personally not a huge fan, but like many statically-typed functional languages, Haskell is great for - creating new programming languages and DSLs - problems in finance, energy, medicine, etc., that are more correctness-sensitive than performance-sensitive (it is widely used in Bitcoin brokerages / exchanges / etc, and in general blockchain technologies) - highly-concurrent scenarios that would otherwise involve a lot of painful management of threads/locks/etc Facebook’s Haxl is a good example of software that uses Haskell effectively: https://engineering.fb.com/2014/06/10/web/open-sourcing-haxl-a-library-for-haskell/ https://engineering.fb.com/2014/06/10/web/open-sourcing-haxl...
- bborud 6y agoI'm not a big fan of DSLs. Yes, they allow for convenient notation to express things within specific domains, but they also create more barriers. It is both more impressive and more useful if one is able to create abstractions in mechanical sympathy with idiomatic uses of existing languages. Of course, this is harder to do. I think DSLs are a bit of a lazy cop-out. This is not a new idea. The myth of the tower of Babel and the observation that by creating lots and lots of communication barriers and interfaces, you lose the ability to coordinate major efforts is indeed very old.
- feanaro 6y agoI disagree. DSLs give you a new set of primitives which is more suited to the problem domain and makes it harder to make mistakes by accidentally encoding things which don't exist in the problem domain. Of course, just making a DSL isn't enough. Some DSLs are badly designed and inelegant, or their features do not compose well with each other. But a well designed DSL can be a thing of both beauty and clarity. I think this shouldn't be surprising as even modern programming languages are DSLs of a kind when compared to machine code.
- fauigerzigerk 6y ago>DSLs give you a new set of primitives which is more suited to the problem domain and makes it harder to make mistakes by accidentally encoding things which don't exist in the problem domain. But domains are interrelated. If there is no common set of primitives upon which various different domain abstractions are built, then you have to relearn absolutely everything for each domain, even things that are not domain specific at all. You end up with a huge number of special cases. Mistakes are made because only very few people will be able to remember all the semantics of all the DSLs they need for their work.
- chowells 6y agoHaskell is really good when: 1. You can afford the costs of a garbage-collected system. 2. Your collaborators know it or are eager to learn it. 3. You intend to maintain your system over an extended period of time while adding features. 4. You don't need close integration with the platform GUI. That last one isn't impossible to do in Haskell, but it's painful enough that it overrides the benefits in a lot of cases. What products niches does this leave? Servers and command-line tools, primarily, though there is room for GUI applications that use various cross-platform UI toolkits and games that build their entire UIs from scratch. (Yes, both of those exist. Even games. Unity uses C#, it's not like garbage collection is incompatible with games - it just has overhead you'll have to live with and work around.) Honestly, condition 2 above is the biggest limit. A lot of people who like to talk about judging things on their merits refuse to learn Haskell because it's not yet another shallow skin over the same programming concepts. My personal experience is that any time you think Ruby would be a good choice for a long-term project, Haskell is a far better option. It supports the same joy of green-field development but is less of a tarpit when the green field is 5 years behind you.
- nicoburns 6y agoSeems like you'd be better off using Rust for most of these. A lot of the same correctness benefits of Haskell, but a much more practical langauge with a more complete ecosystem of libraries.
- chowells 6y agoRust? It's a fine C++ replacement. But it has nothing on Haskell in terms of practical expressiveness. I'll give it another look when it's capable of expressing an idea as simple as traverse.
- _huayra_ 6y agoAmen. The real benefit of Haskell is not some hyper performance optimization (when you actually truly need C++ or Rust), but for business critical applications that need to perform fairly well and, most critically, need to not be filled with bugs as it continues to evolve. Whatever amount of money someone might lose by using Haskell compared to Rust or C++ (e.g. in hiring trainers to train your engineers, the overhead in terms of your PaaS bill due to GC or whatever else) is very small compared to the savings: - Compensating a customer for an SLA violation due to some inadequately tested code path that caused an outage - Wasted developer time trying to act like a Human Compiler (e.g. including a bunch of extra code to check type expectations and handle violations gracefully....at runtime) - Wasted developer time trying to understand the dynamic behavior of some code in a PR - Wasted developer time trying to understand old crufty parts of the codebase when you refactor Perhaps it's slow(er) to compile than you might like or not as optimal as C++, but unless you can afford to hire the absolute best Python / Ruby developers available and have some airtight culture of documentation and best practices, I would venture that it's better off to stake one's intellectual property on something that can survive employee churn without that knowledge walking out of the building.
- Jenz 6y agoHaskell is fantastic for programming systems where types are not just a tool, but central to the goals of the program. E.g. a program for converting one type of markup files to another (from one type to another type), like pandoc [1], which indeed is written in Haskell. [1]: https://github.com/jgm/pandoc https://github.com/jgm/pandoc
- ghc 6y agoHaskell is good for correctness. Where correctness really matters, you might find Haskell. That makes it a very niche language, as most developers don't really care about correctness. But you do find Haskell in places where complexity is high and correctness matters. Mostly banking, infrastructure, defense, and research applications.
- newswasboring 6y agoEveryone makes this point about correctness, but I have never seen an easy to understand illustration of this. Now I am by no means a leet programmer but I have been reading about programming for more than a decade and every article about this point feels confusing. I even tried writing small stuff in haskell, still don't get this point.
- alisonkisk 6y agoCorrectness is only an interesting problem when it's not easy to underst example and. Easy bloggable examples aren't complex enough to be correctness challenges
- newswasboring 6y agoOk. Then what book can I read to understand this. I've read two books on haskell but they were beginner stuff though
- ghc 6y agoClosest I can think of is Purely Functional Data Structure (Chris Okasaki) or Category Theory for Programmers (Bartosz Milewski), but they're not exactly what you're after. I would submit that this paper from FB is more in the vein of what you're looking for: https://research.fb.com/wp-content/uploads/2020/08/Eliminating-Bugs-with-Dependent-Haskell-Experience-Report.pdf https://research.fb.com/wp-content/uploads/2020/08/Eliminati... . This interview might also be insightful: https://www.microsoft.com/en-us/research/podcast/functional-programming-languages-pursuit-laziness-dr-simon-peyton-jones/ https://www.microsoft.com/en-us/research/podcast/functional-... The truth is that Haskell is still very academically focused, so you're likely to see papers of substance much more often than books or blog posts. When you hire people to write Haskell there's two groups that always show up: young enthusiasts who are frustrated with imperative programming in their (usually first or second) day job, and academics who got transplanted into industry to work on hard problems. I've interviewed people doing formal verification of CPU circuits at Intel, people who work on compilers, people who work on verifying termination of programs (for missile guidance), and people who work on financial institution backends. What I haven't seen is too many experienced, pragmatic engineers (rather than computer scientists) who have spent their career writing Haskell.
- whalesalad 6y agoI’ve always felt like Haskell was purely an academic language used to argue about what monads are.
- dcolkitt 6y agoHonestly, I feel like the success of Go has eaten some Haskell’s lunch. I used to use it when I was reaching for a native binary with near-C performance, but wanted an easier to maintain, terser, GC language. Nowadays that’s pretty much Go. But if the problem would benefit from a lot of higher-level, Haskells still a good choice, given Gos lack of generics.
- likeclockwork 6y agoD is my goto when I have similar requirements.