Skip to content

Comment on 2022 State of Haskell Surveyparent

Comments

How is package management these days?

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).

We use Stack together with Nix to pin all dependencies. That works very well.

Could you elaborate on the path you took here? Sounds interesting

Stack comes with built-in Nix integration: https://docs.haskellstack.org/en/v2.9.1/nix_integration/

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"]

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.