This is maybe a big ask, but could anyone who has been a long time Haskell user give some bullet points on major language developments since ~2015 or so?
I was deep into Haskell and used it as my primary language from 2012-2015, but switched over to Rust around that point. I've been thinking about trying a mid-size hobby project in Haskell to get updated on the new state of the art.
Some things I have heard tangentially (and may be misremembering):
- Field accessors (i.e. `myObject.field` instead of `field myObject`)
- Monad hierarchy refactoring (monad of no return)
- LiquidHaskell making some inroads
How is package management these days? Is cabal hell still a thing? How's the IDE situation?
Cabal's been fundamentally redesigned to have "Nix-style" builds. This has solved most of the problems I remember encountering with the tool. These days, I only have issues when packages have incorrect or incompatible version bounds on dependencies.
Tooling has improved massively in general. ghcup can install and manage versions of Cabal/Stack/GHC/etc automatically. The Haskell language server provides reasonable editor-agnostic IDE functionality; I've been using it for a while now and have found it to be useful and solid.
The language itself has had a bunch of small quality-of-life improvements. The foundation still feels the same—not a major change like jumping to dependent types or something—but lots of rough edges have been sanded off.
I've been using Haskell for over a decade now and I'm very happy with the progress of the language and the ecosystem over the last several years.
We use Stack together with Nix to pin all dependencies. That works very well.
> Is cabal hell still a thing?
No.
> How's the IDE situation?
Much better than it was. Haskell Language Server (HLS) has been a game changer. It works very well and can be used with different editors (easy to install for VS Code for example).
By default this will mean that Stack will use Nix to download non-Haskell dependencies. E.g. GHC and external C libraries will be downloaded by Nix.
This allows you to pin all dependencies that you have, including the compiler and external libraries (make sure to pin a specific version of nixpkgs though). And it will give developers a reproducible build environment.
It is also possible to take this Nix integration even further and make Stack download all Haskell dependencies from Nix as well. However, this requires to write a custom `stack-shell.nix` file, so I would only recommend this for people who are already familiar with Nix.
This file must then be configured in `stack.yml`
Example `stack.yml`:
# Using a `ghc-*` resolver means that stack won't try to download and build any packages itself,
# instead it will only use the packages that are shipped with the compiler.
# In `./nix/stack-shell.nix`, we ensure that the compiler indeed ships all the packages we
# need.
resolver: ghc-9.0
packages:
- "."
# This makes stack pick up our nix environment for building by default.
nix:
enable: true
shell-file: nix/stack-shell.nix
path: ["nixpkgs=./nix/nixpkgs-pinned.nix"]
I'm a relatively newcomer so maybe discard this comment. What hurts me most at this point is the lack of documentation, or at least the lack of simple examples. This is the only language I know where more often than not the main documentation of a module is a link to a journal paper. Alternatively, I'm just not always able to infer what a function does just by looking at its signature. Just give examples.
I have tried to push for a Haskell in my previous job. We had a task that was especially well suited for that. It was a large collection of mostly declarative computations for the mixed-integer optimization. I also wanted to take an advantage of Liquid Haskell since that would allow us to move a few checks from runtime to compile time. That would be a game changer. Things like divide by zero were very common. It is easy to detect division by zero but not so easy to cover all the edge cases that could cause it.
At the end of the day we did not go forward with that. The reasons mostly were:
1. Even though I used a lot of my "social credit" on this everybody was scared of it. Mostly because of the vibe that comes with Haskell.
2. Purely functional languages come with lots of concepts that are unfamiliar to most programmers (everybody in my team was well equipped with CS degree and theoretical knowledge but still those concepts were new-ish).
3. The higher in company hierarchy the more people were scared (this was a critical project for the whole company of ~22k people).
4. We couldn't figure out debugging. Our codebase was ~40k generated lines of code (type definitions, basic accessor functions and so on) plus ~10k LoC we would write on top of that. The only VSCode-based debugging I was able to figure out was basically loading it in GHCi and then doing the debugging which was fine. The problem was the load itself. It took ages because it recompiled majority of the codebase on load. No precompiled parts were used. Result was that every debugging session took minutes to start up.
On the other hand Liquid Haskell has a great potential and I hope that there is a future in which we have similar tools in more common languages. As the complexity of the codebase grows it become more important to have a tool to provide additional guarantees. We did not have much of the code on its own but it was packed with complexity and dependencies. Liquid Haskell seemed to provide a tool that does not get into your way when you don't need it but it available when you want it.
I hope tooling becomes the #1 priority.
- after using languages like Rust and Elixir, It's hard going back to other langs where the tooling is not at that standard,
My editing cycle is pretty terrible. usually vim in one terminal and another terminal to run ghci or stack build. That's ok, it lets me work through my toy problems.
But compared to IntelliJ or even coq and proof-general, it's a lot rougher to loop through type in new code, run it, fix or next batch of new code.
obviously developers are going to use whatever they want, but it would be really nice to see a setup with _anything_ emacs, visual studio, atom whatever. and show how to get to that setup, and how to quickly test, analyze performance, refactor.
Refactoring is Haskell's super-power. I change things and chase compiler errors, and it works well enough. Compared to even java/eclipse 15 years ago it feels primitive. it works, I can get by. I'd like to see how "grown ups" do it.
Have you tried the Haskell language server? I don't think it has project-wide automatic refactoring—maybe that's something people are working on, but also seems quite difficult—but it definitely tightens the write/compile/fix loop.
I think I did, I think I spent some time puttering around trying to get a setup to match my config.
I would suggest, a clear path in a getting started guide - if you use this editor and these tools, you will have a working system end to end. maybe a short video showing interaction with that specific toolset.
I got sort of mired in what packages to use for emacs. I don't really know how other people have their stuff set up. Not having a clear path, I just kinda winged it. And was not successful.
I understand all the parts of my current workflow.
There's nothing wrong with presenting 500 options for solutions. But it would be really nice to have a "do these 5 things and you're good to go". Any set of tools would be fine. I can compare a working system to my system and puzzle out what I need to configure.
That may already exist, and I missed it. If that's the case, make that guide more prominent. I seem to recall looking around a lot.
### Editor
*Visual Studio Code* is a popular choice with well supported editor integration. Install the [Haskell extension](https://marketplace.visualstudio.com/items?itemName=haskell....) and you are all set. It should work out of the box and use your installation of HLS.
I really wish I could use Haskell all the time instead of Python and the most dreaded programming language, a.k.a. MATLAB.¹ I guess all that's left for me is to do whatever toy projects come to my mind in my free time.
Doing chores, playing music, playing video games, laying about, walking. I also tend to browse random Haddocks and source code on my phone the same way I browse other websites.
It's mostly a subconscious thing. I can't tell you how many times I've had a Haskell problem to solve (highly-abstract and systems programming alike) and I take a couple days off the keyboard and come back and write code that'll last years.
Of course, there's still a time and place to do the whole tight feedback coding loop thing. But it isn't how most of my Haskell comes to be.
Yeah, I'm a very type-driven dev. So sometimes I'll get stuck with my types and not know a way forward. Usually the answer pops in my head out of nowhere. Reminds me of when Nietzsche said ideas were out in the world, waiting to be bumped into on a walk.
Sometimes it's more that I have a tedious problem and think surely there's a better formulation. That also is a good thing to grind in the subconscious.
There are still some problems for some project I haven't solved too! It'll come.
As a non-Haskeller, the only tool I can think of interacting with that has any Haskell is Hasura's graphql-engine[0], which GitHub stats say is 28% Haskell (and then like 55% web languages, so I assume the backend is all Haskell and the web languages are for the UI it presents etc)
Are there other popular Haskell tools? Or is it more of an academic language? I was surprised to see it on the GitHub repo.
There’s a bunch of issues with how these surveys have been designed in the past, imo, and generally solicitating easily interpretable qualitative responses on technical systems is just hard.
I was deep into Haskell and used it as my primary language from 2012-2015, but switched over to Rust around that point. I've been thinking about trying a mid-size hobby project in Haskell to get updated on the new state of the art.
Some things I have heard tangentially (and may be misremembering):
- Field accessors (i.e. `myObject.field` instead of `field myObject`)
- Monad hierarchy refactoring (monad of no return)
- LiquidHaskell making some inroads
How is package management these days? Is cabal hell still a thing? How's the IDE situation?