r/haskell • u/n00bomb • Jun 24 '20
[PDF] Haskell for a New Decade [pdf]
http://dev.stephendiehl.com/new_decade.pdf40
u/dnkndnts Jun 24 '20
To the first part, I do agree software is a shitshow, and there's an engineer in me that wishes we would do a better job building things. But there's another part of me that's kinda okay with this: outside academia and open source, much of what we do with software is stuff that I frankly disagree with at a very fundamental level (most prominently, mass surveillance, though that's far from the only thing), and I do believe there's a real sense in which the only thing saving us from ourselves is that we're too stupid to successfully engineer our own doom. To the degree that we're going to continue using our tools to pursue such foolish ends, I raise a glass to the shitshow and pray it continues until we can find more inspiring directions to allocate our talent.
Inside academia, at least in our circles, the situation isn't too bad. I do think our forefathers from the early days of formal logical study and theoretical computer science up to around the '80s were smarter than we are today, but still, there's plenty of good work being done now, and I maintain high respect for computer science as an academic discipline.
Regarding Haskell and GHC, I do agree about the concerns over the intimidating complexity of the GHC codebase and the continual addition of ever-more-complicated language extensions, and this only gets worse as we continue taking awkward steps towards dependent types. Languages like Agda and Idris 2 that were built from the ground up on this theoretical basis feel both more expressive and simpler, both in terms of semantics and implementation. Further, I worry that unifying the type and value namespaces as part of dependent types in Haskell is just not viable at all, given how much of our existing code is written with the assumption that these namespaces are distinct. Perhaps there's some way to pursue dependent types without a unified namespace, but I don't imagine it's elegant.
As for our ecosystem, of all the things discussed this one I'm most optimistic about. Cabal version 3 is a vast improvement over what we had before, there's good development actively being done on core libraries like vector/random/bytestring/network, and it looks like in the near future our editor tooling may be competitive with many mainstream languages. While some independent libraries on hackage have bitrot, there's still no shortage of actively-maintained, high-quality packages. Moreover, in no small part due to our language's natural purity and clean syntax, I simply trust our packages more than I do those of more mainstream ecosystems. I don't feel any fear that when I do cabal install package that I'm going to be installing an insidious bitcoin miner into my project alongside the actual library or that I'm going to see ads in the terminal or any other such nonsense that occurs with disturbing frequency in mainstream ecosystems.
Regarding the job market: we are small, of course, but I also think we may have less employee turnover than mainstream software ecosystems. According to Forbes, median tenure at companies like Amazon and Google is only one year. So yes, when you look at that world, you're going to see a lob of job ads, but they're mostly low-quality, short-term gigs.
Overall, despite the problems discussed, I remain optimistic about the next decade for Haskell and the surrounding ecosystem. Certainly more optimistic than I am about the next decade for the world at large.
9
u/lambda-panda Jun 24 '20
Cabal version 3 is a vast improvement over what we had before..
This is so true. I cannot wait for it to replace stack workflow. It is a bit sad that we might drop stack like that. It was a real savior when it was introduced, and I really think the Haskell ecosystem would have a hard time, or even never took of like it did, if it was not for stack.
But now, may be it is time to drop it.
8
u/Silhouette Jun 24 '20
As a counterpoint, I have seen Stack do more harm than good. Its goal seemed to be enabling a simple, predictable build process, but in my experience it never really achieved that. Far too often, I pulled the latest from source control after even just a few months working on other things, told Stack to build it, and saw a failure, which is probably the most profound failure a tool like that could have. Most places I know that tried it (admittedly not the largest population in the history of statistics, but all I have to go on) subsequently went back to Cabal for similar reasons, particularly once the newer generation of commands that offered some of the same benefits as Stack became available.
At this point, I for one will be delighted if the Haskell community does standardise on a single default package repository and a single default toolchain that handles the essentials of dependency management and versioning and then gets out of the way as quickly as possible. I think for a relatively niche language, that consolidation within the community is probably a significant advantage. Right now, I think the only credible contenders for those roles are Hackage and Cabal, but it's the principle of standardisation that really matters.
7
6
u/endgamedos Jun 25 '20
As much as stack frustrates me when I try to use it, I have to raise my glass to it as a necessary kick-up-the-pants. I look forward to a future where it is not necessary but do not deride its effects.
3
u/JKTKops Jun 24 '20 edited Jun 11 '23
This content has been removed in protest of Reddit's decision to lower moderation quality, reduce access to accessibility features, and kill third party apps.
3
u/vagif Jun 26 '20
Intero is dead. And HLS fully supports stack btw.
2
u/JKTKops Jun 27 '20 edited Jun 11 '23
This content has been removed in protest of Reddit's decision to lower moderation quality, reduce access to accessibility features, and kill third party apps.
2
u/Burtannia Jun 25 '20
I'm not sure how many people also use it, but I'm a massive fan of Visual Studio Code + plugins. I also like VS Code's use of WSL which allows me to use an Ubuntu environment for compilation while running Windows.
1
7
u/dontchooseanickname Jun 24 '20
We're too stupid to successfully engineer our own doom
Please, please, please - Grant me a right to use, abuse and re-quote you now and for long !
1
u/vagif Jun 26 '20
There's no such thing. All you have to do is look at what we are doing to our planet. Destroying things does not require intelligent mind.
9
u/Burtannia Jun 24 '20
I'm always excited by the potential that Haskell brings to the table. I truly believe that the most powerful combination of languages is Haskell and C++. There will naturally be times when one requires low-level imperative control over things like memory allocation and wishes to completely avoid things like garbage collection. In said scenarios a language like C++ is incredibly powerful.
On the other hand the vast majority of code does not require such a level of control and is instead written at a higher level of abstraction. This is where Haskell shines, we have type safety, access to infinite lists thanks to laziness, algebraic data types which make it easy to create embedded domain specific languages... These and many other features result in code which is concise, expressive and runs efficiently while also providing us with a greater degree of confidence of correctness than if the code was written in a language with less type safety.
So where do we go from here?
There are many "issues" in the Haskell ecosystem as there are in every language's ecosystem. In my opnion the largest of these problems is that few companies use Haskell. Why is this? There are 2 main reasons, firstly, a lot of people have never heard of it and secondly there are nowhere near as many people that know Haskell as know other languages thus hiring becomes more difficult. So what is preventing people from learning Haskell? Firstly there aren't that many Haskell jobs going round compared to other languages. This creates a sort of chicken/egg problem. Secondly the barrier to entry is quite high, Haskell looks completely alien compared to your average language. Many people encounter Haskell, don't understand why they can't just do things they do in other languages and never touch it again.
It's clear that we've done a good job preaching the benefits of languages like Haskell; many languages from C++ to that tragic accident known as JavaScript have implemented features that originated in functional programming. We must continue doing this with emphasis on the other benefits that Haskell brings to the table and why simply adding lambdas to other languages is insufficent.
What we have not done a good job of, however, is creating demand for Haskell programmers. If you're creating your own business, use Haskell, if you're working at a startup, suggest using Haskell for something. If we gradually increase the number of Haskell jobs by starting from the bottom then we will create more demand for Haskell programmers. This will bring more people to Haskell and all of a sudden many of the other problems will disappear. Standards will develop over time for different use cases and many new libraries will be created to fill gaps where gaps exist.
It is also worth pointing out that GHC is not Haskell. GHC is aimed at academic research first and foremost. I think that GHC is perfectly viable for industrial use cases but there may be certain scenarios where it is suboptimal. There are several alternatives to GHC which attempt to be more suitable for industrial use but I have yet to hear of a specific one which is significantly ahead of the others. This is yet another problem that would vanish if Haskell were to gain more industry traction. A company backing the development of a GHC alternative, whether it be an existing GHC fork or a new one, would not only provide such a project with direction based on real world use cases but also the stability of not just being someone's summer project only to be left to rot after a few months of updates.
In summary, we have to use more Haskell so that other people start using a little Haskell. Once this happens then many of the other issues will begin to resolve themselves naturally.
5
u/Gushys Jun 24 '20
As a younger dev who is interested in learning Haskell and helping it grow. What are some use cases that would make haskell the best tool for the job? What are some projects to get started on that help to ease the barrier to entry
3
u/Burtannia Jun 25 '20
I'd first like to mention that I too am a "younger" Haskell dev. I finished my master's degree last year so I'm not someone with masses of experience. I was incredibly fortunate to have studied at the University of Nottingham, a place where functional programming, and indeed Haskell, is taught quite a bit providing you choose to do those modules. If you're still at an early stage of learning Haskell I recommend the book "Programming in Haskell" written by Prof. Graham Hutton who was my 3rd year dissertation supervisor. Make sure to look at the 2nd edition. If you've already done a fair bit of Haskell it might be worth looking through the chapter list first to ensure there are things you haven't learnt about yet.
As for use cases... A very simple one which can be a very nice introduction to using Haskell in a larger project is creating a website. I highly recommend the Yesod web framework. The book on Yesod is great and is also freely available on the website. I found that it gave me a more tangible understanding of how Haskell's useful features actually become useful in a real setting.
On a slightly darker note due to recent world events, we're likely to see some significant economic problems over the coming years. As is always the case during such times, many new companies are started. While many will fail, some will be the "big successes" of the next decade. If you end up creating a company, use Haskell as much as you can. If you start working at a start up, suggest using Haskell. Imagine if Uber, which was founded in 2009 during the financial crisis, used Haskell! Naturally if there is a good reason to not use Haskell, don't force it. If you need fine control of memory allocation then C++ is probably a better option. But that said C++ can interact with Haskell via the foreign function interface (FFI) so it might be that you write some highly performant C++ then surround it with other components written in Haskell.
As I mentioned in another comment, Haskell is ideal for writing embedded domain specific languages (EDSLs) which opens up a wide range of use cases. If you're interested I recommend reading this paper.
3
u/Gushys Jun 25 '20
Thanks for this! I've had a bit of exposure to haskell during undergrad but mostly just wrote some small functions. In highly interested in functional programming and what better than to pick up a functional language that is pure and strict to learn. I've been in the professional world for a bit more than a year but mostly doing object oriented work.
If I can learn enough Haskell to be dangerous I definitely think I'm in a good position to maybe introduce it into work. I appreciate the reading suggestions. Cheers
8
u/valcron1000 Jun 24 '20
As someone that enjoys writing Haskell this kind of worries me. Seems like Haskell is being forced to become a dependent-type language and it feels unnatural. Some might say 'but it's GHC that's changing, not Haskell'. Well, I think that GHC IS Haskell at this point - try to find some other working implementation.
I love the base language and I feel like it's enough for most tasks - maybe because I haven't played around with advanced extensions like type families or GADTs so 'I just don't know what I'm missing'. There are issues like the String ~ [Char] thing, records, and the Prelude, but those could be easily fixed. If I wanted a dependent-type language I could look into Agda or Idris, but not Haskell.
I just want a general-purpose programming language that's functional, pure, provides a strong and advanced type system, compiles to native code, with minimal to no "magic" features (ex. keywords for 'async/await'):
Lisp and derivatives are dynamic like Erlang and Elixir
Ocaml is impure and multicore is not yet a thing
Elm/PureScript compile to JS
Scala and F# are impure and require the JVM
Idris is too young for general purposes. Looks like the successor of Haskell.
So, for now Haskell looks like the only option. I'll just keep using a small subset of the language and be done with it.
5
u/ItsNotMineISwear Jun 24 '20
Seems like Haskell is being forced to become a dependent-type language and it feels unnatural.
We'll have
-XDependentTypes, but theXis the key part! Extensions get a lot of flak for lacking focus, but on the flip side, they make it so people with different goals & tastes can coexist. So you'll be fine :) I'm sure I'll write plenty of imperative code inIOeven when we have dependent types.9
u/cdsmith Jun 25 '20
We'll have -XDependentTypes, but the X is the key part! Extensions get a lot of flak for lacking focus, but on the flip side, they make it so people with different goals & tastes can coexist. So you'll be fine :)
I feel like this is overly dismissive. The changes in GHC that result from the push for more advanced type system features are definitely changing the experience of using the language. As the parent comment says, Haskell is GHC; but more to the point, Haskell is the Hackage library ecosystem. As these things move toward dependent-typing and other advanced type system features, it's not just people researching dependent type systems who feel the effects.
Now, I don't agree that these effects are all negative. Rank-n types, GADTs, type families, etc. are contributing positively to the Haskell ecosystem. (In fact, I hope we can one-day deprecate non-GADT syntax for algebraic data types, which is jumbled and confusing about what's a type and what's a term.) Perhaps some of the newer dependent-type stuff will similarly be easy to use and helpful. But it would be silly to argue that you can just ignore them if you don't want them; you cannot ignore type system features that are used by the libraries you need.
4
u/ItsNotMineISwear Jun 25 '20
If your only option for a library you need is one with large use of dependent types, either there's room for an alternative that makes different trade-offs in its API or the dependent types are just that good for the problem at hand. I think that's a non-problem at best and self-correcting one at worst in practice.
1
u/vagif Jun 26 '20
Besides using a library that utilizes dependent types does not force the developer to introduce dependent types in his own code.
1
u/bss03 Jun 27 '20
Using a library with dependent types in it's API does require the developer to introduce dependent types into their own code.
0
u/vagif Jun 27 '20
How is that different from say a library that has lense types in its API? Obviously if it is in API contract then that is the decision the library developer has made. And such decisions are not made lightly.
1
u/bss03 Jun 27 '20
The type of lenses has always been available in Haskell (at least since '98), so it's not new and disruptive and a potential blocker to new adopters of Haskell.
1
u/vagif Jun 27 '20
We are splitting hair over a hypothetical library that is immensely popular and does not exist.
3
u/bss03 Jun 27 '20
We are a fragmented community that only gets more splintered each time an extension allows for an API that requires that extension.
We can't decide on a build system, we can't decide on a standard library, we can barely agree on a compiler, and we haven't had a language spec that wasn't DoA for 22 years.
This is the best our tooling and compiler has ever been, and I want to use linear and dependent type ASAP! But, let's not ignore / deny that they have downsides.
13
Jun 24 '20 edited Jun 24 '20
I have been "watching" haskell and playing with it a bit for the last 10 years. To me it seems like it could (should?) learn a lot from LISP. To a certain extent, it seems to have done so - if you wanted a s*itshow, that's modern LISP today and I think Haskell has avoided at least some of the pitfalls there.
However, the only other "functional" language that "made it" is Scala. The only reason Scala made it is because of the big data buzzword and Spark and of course, its interoperability with Java. For some reason going from C to Haskell is not a path but jumping from Java to Scala is a natural progression in the life of a serious engineer.
What Haskell is fighting is what universities have been fighting for decades - the giant disconnect between computer science as a science and software engineering as engineering. Due to huge demand in the field, you do not have to be a computer scientist with formal education to have the title of software engineer. In fact, when you go get a computer science degree at a university, do you really become a software engineer? This question has still not been resolved cca 2020.
It doesn't help that a lot of "great" software engineers are people who come from other disciplines like math, physics, English etc. Even in the field of academic computer science, you have disciplines like bioinformatics that used to be and still are filled with biologists (makes sense) who write horrible software that does alright for proof of concept but ends up being standard tooling.
Back to demand - there is so much of it that it has outpaced quality control by orders of magnitude. What people are basically trying to do is solve this problem by inventing better languages and tooling but as they are doing that the demand is growing in parallel and at a higher pace than the pace of work into bettering things.
The whole world has been moving to "modular" and "easy", due to demand pushing standards of quality down. I once interviewed a fresh computer science grad from UCSD (with a 3.4 GPA) for a position, who could not answer the question "what is a (CPU) register"? I have interviewed people who could not recognize the sequence of prime numbers. So, you cannot expect people to take to essentially mathematical concepts (basis of FP and Haskell in particular) when they have poor math background. Did I mention that back in college, my intro to calculus class had to drop two of the worst test results in the year because the failure rate was 56%? People complained and pressured the professor to water everything down. When you pay dearly for education, you expect the paper to say you passed...
I think the whole concept of "dumbing" everything down so that the lazy and (formally?) uneducated can grasp and work with things is misguided. You do not have to have formal education in math and computer science to work in the field but if you are not interested, well, some things and concepts will be off limits and for me, that's OK.
What I want to see is new software engineering concepts implemented in Haskell, the way LISP was a machine that kept on giving things to the world decades ago, things that trickled into other languages and environments maybe even decades later. I would still use LISP today (or Scheme) were it not such a s*itshow and hodge-podge of crap of various levels of completeness, correctness and overall quality (thinking ecosystem here). One thing I also dislike about modern LISPs and Schemes is the deluge of special parameters to every function and data structure - you have to remember all of these things and they all feel like exceptions. Macros are a great things but their derivations should not be a part of the language base, or at least you have to have some control over what and how much is part of the entry to the language. I feel like Haskell avoided this for the most part. Scala managed to avoit it as well but the Scala ecosystem is also a hodge-podge of half baked stuff as well.
In fact, half baked is what describes the whole industry today. It all comes from pressure to produce and make money - we have all bought into the "since we know we cannot prove that every bug has been fixed, we might as well accept that and release stuff knowing there are bugs even when we actually KNOW they are there".... Once you cross that line mentally, it is all downhill from there. If you look at places where bugs would result in immediate deaths (airplanes, medical devices etc.) - the pace is much slower and people are more careful. Tooling still sucks though.
3
Jun 25 '20
Start more companies. That's what I've been feeling it would take to increase the market and demand for Haskell programmers as well as inject funds into the ecosystem to support and sustain Haskell development. More startups choosing Haskell is great exposure.
One of those startups "making it" would be huge.
If I was in a position to do so I think I would. The only thing stopping me is that I haven't made enough money to support my family for a 6/12 months while I build up a company.
I am fortunate in that I get to ship Haskell code into production at work... but I'm still the only developer shipping Haskell code into production. Such a bus factor isn't good and with nobody else interested in learning Haskell to maintain it (and I have tried to build that interest, I'm not just sitting back wondering why nobody is interested) I have to be prepared for the day when I'll be asked to help re-write it.
2
u/sjakobi Jun 25 '20
Why is it that your coworker aren't interested in Haskell?
3
Jun 25 '20
From what I can tell it's mostly because they prefer other languages and don't have a desire to learn Haskell.
2
u/fddde6 Jun 27 '20
Starting here Stephen talks about cryptography/"cryptosystems" and how Haskell is a good fit for implementing some of those ideas directly.
Does anybody have recommendations on where to get started with the stuff he mentions? Textbooks, libraries, blog posts, etc.?
2
u/fsharper Jun 26 '20 edited Jun 26 '20
When programming Haskel, sometimes one has the impression that the language throws at you sudoku-like problems with types that are not related to the domain problem, but with the monadic system. Sometimes they add some value but sometimes don't. Monad transformers are too rigid and effect systems are too verbose for the functionality that they bring.
I empathize with the newbie programmer in Haskell (but experienced in other languages) who for chaining two calls coming from different libraries need to learn a lot of things unrelated to his problem, in order to insert gluing stuff here and there to make them compose. That is for me the cause of the lack of adoption. Haskell composes less and less each day with the proliferation of different monadic engines.
I wish to have something like the Fran effect system. Unison has such an effect system. The syntax is much less cluttered with accidental complexity. I think the Unison people made an excellent decision there. Concerning effects management, Its syntax is by far more natural.
The problem with monadic systems can be extended to other aspects: streaming ecosystems are incompatible between them. There are a dozen ways to do each thing and a few more each year. Breaking changes is another thing that the haskellers do without remorse in libraries, even in the language itself. Perhaps all of this is the unavoidable consequence of the roots of Haskell, as a research and experimental language.
The Haskell rank in popularity among programming languages has descended since the introduction of things that supposed a complication without an accompanying advantage, at least for foreigners, like type-level, lenses, effects systems, and a lot of noise about category theory.
-12
Jun 24 '20
Absolutely ridiculous presentation.
Says GHC development is impossibly complex, proceeds to give link to GHC dev mailing list.
Also, companies being cautious has to be changed by... new non-cautious companies that will throw money on Haskell until it gets stuff done while getting bankrupt?
1
u/bss03 Jun 24 '20
I'm not sure it's ridiculus, but the connection between the problems and the solutions is certainly not made clear by the slides. (I didn't listen to the talk.)
0
Jun 25 '20
[deleted]
3
u/sjakobi Jun 25 '20
The miserable arrogance of lacking both self-reflection and ambition that i saw in a recent thread on this topic finally made me give up on haskell.
Do you mean this thread?
https://www.reddit.com/r/haskell/comments/gtm3w0/on_marketing_haskell/
I thought that was a particularly poor showing. It appears that Stephen Diehl is really hitting some pain points in the Haskell community. I hope it's for the better.
6
u/libscott Jun 24 '20
I would like a new Haskell. Something like:
Strict by default (lazy variables / scopes)
Some memory management features (perhaps using a typeclass?)
More modular RTS, can run with no RTS at extreme
Can compile to WASM
Pluggable scheduling
Port from Haskell with minimal effort