I’m starting a new project next week, and will likely be able to use Haskell. I’ve been doing other things for a few years, but prior to that I was using Haskell in production, writing Servant microservices, etc.
Catch me up! Here are some questions:
What’s the modern way to build applications and fetch dependencies? Last time around I was using stack for everything (including getting ghc binaries). I know of ghcup, but does it do anything besides install binaries?
What’s the latest in effects libraries? Any recommendations on where to look first?
Is dot syntax working for updates yet? Last I checked, the record-dot-preprocessor worked well, but the GHC extensions required implementing HasField by hand for updates.
You’ve already mentioned it, but ghcup is now the way to go for managing your installation of ghc, cabal, stack, and hls. You can now have multiple versions of each installed on your computer, and with hls you can have vscode automatically detect and use ghcup to install and select the proper versions for your project. I used to have a whole nix setup that I used to control this for everything, but now I can just use ghcup + cabal because it has improved so much compared to the past.
Other less visible changes are the vastly improved support for ARM architectures, as well as the ongoing work on the JavaScript and wasm backends, and finally there is also the the new low-latency garbage collector which has made Haskell more suitable for real-time applications. All together, Haskell is usable in more places, in more ways than it ever has before.
ghcup for managing GHC and cabal in my experience works well.
There were new developments in this regard with focus on practicality. Have a look at the effectful library, it solved most pressing issues of older libraries like poor performance and integration with the rest of the ecosystem.
Sadly it doesn’t yet. But have a look at this tutorial, with the optics library and generic optics updating records is not a problem. And since GHC 9.2 and NoFieldSelectors extension the ugly prefix convention can finally be dropped.
Btw, the note in the “Sample usage” section is somewhat outdated. I initially wrote it, but since then I switched from TH to generic optics in a quite large codebase and it turned out they’re fine, so I really need to change this note to be less scary. Implementation in the optics library is well optimized for compile time and run time performance.
ghcup for installing your tools: ghc, stack, cabal and hls (even stack can rely in ghcup for instalation). Use cabal or stack for dependencies. cabal has overcome stack in popularity due to new nix-style builds. Both are good options.
I’d say effectful. But not very fan of effect systems right now
The extension -XOverloadedRecordDot allows for the use of struct.field. It defines HasField instances for you. -XOverloadedRecordUpdate is apparently very experimental and you need a few extensions to make it work
If you haven use hls; it is a good improvement in the last years.
On (1): on top of what everyone else said, I want to emphasise that Cabal really is better than Stack now. As far as I’m aware, the latter is near-unmaintained.
On (4):
HLS is vastly improved. The IDE experience is much nicer than it was a few years ago. (And it works much better with Cabal than with Stack; another reason to switch!)
GHC recently had backends for JavaScript and WASM merged in — they’re at a primitive stage, but usable for some tasks, and rapidly improving.
The Haskell Foundation has made the Haskell community a lot more organised and focussed.
I think maybe “sandbox” means something I didn’t intend in regards to cabal. What I meant to ask is: Can I run cabal build in multiple different projects on the same computer and not have them conflict?
What has changed is that a part from tooling nothing has really changed .
We use to have people exploring new ideas (lens, servant, different form of effects ), that doesn’t seem to be the case anymore (lookes like some people have got kids or moved to Rust or both ).
There has been some work on dependent and linear types but nothing really helpful for “normal” haskellers.
The records problem is still a problem in spite of new extensions .
Well, a lot of things. For example, I finished the second edition of my important Functional Design and Architecture book in which I demonstrated a really pragmatic approach that is better than effect systems.
But Haskell is in the middle of the existential crisis at the moment. Most haskellers don’t agree with me on this but I see that Haskell loses the market constantly.
En garde, sir! I can’t agree with you on either point. A lot of online commenters seem to want these things to be true, but I think they must not be really looking. Eg:
OK, point made. I’ve heard ‘near-unmaintained’ a few times recently; my bad for not verifying. Still, Cabal supports things that Stack doesn’t (e.g. backpack), and its HLS support is generally better (or at least it was last I looked).