Description
Many build tools have the concept of a "dev dependency". These are dependencies which are managed by the build tool, but which are not used by any of the actual build products. Instead, they are there to provide tools that developers of the project will use.
Why have such things managed by the build tool? Can't users just install them separately? There are a few advantages, such as convenience and consistency between developers, but I think there is one that is very important in our case: the build tool may have information that makes it much easier for it to get the "right" tool. For example, many development tools themselves expect to interact with the language toolchain and build tool. It can therefore be important to pick a tool version that's compatible with the toolchain that you're using.
This is becoming very pertinent in the Haskell tooling ecosystem as more things depend on the ghc
library. A tool which depends on ghc
, like haskell-language-server
, must be built with a version of ghc
that exactly matches the compiler the user is using for a particular project (which may indeed differ between projects!). As it stands, this creates a lot of work for users and developers. Users must carefully manage their tool installations to make sure they have precisely the right version of the tool installed for the project in question.
But we already have a tool that has all the information about what version of ghc
you are using and how that affects what versions of haskell-language-server
you can use: namely cabal
!
So much for the motivation, what am I concretely suggesting?
cabal.project
learns a new field:dev-tools
, which is a list of component specifications a labuild-tool-depends
.- Some
cabal
command will build all thedev-tools
and install them into some project-local location.- I don't know what an appropriate command is or an appropriate location (although I think it should be project-local): suggestions welcome!
I don't think the dev-tools
build should include constraints from the components in the project - the implicit constraints on ghc
, Cabal
etc. should be enough.
Partial duplicate of #5588, but I'm making quite a different case, which I think is much more compelling than just convenience.
Many of the other build tools which have "dev dependencies" also use them for things that have better solutions in cabal
, e.g. for build tools, test dependencies etc. I think there's still a useful role for dev dependencies that are really for developers only.
A short list of things I expect people might want to put into dev-tools
:
- Language servers:
haskell-language-server
/ghcide
etc. - Formatters:
ormoulu
/stylish-haskell
/brittany
etc. - Linters:
hlint
/stan
(stan
does actually rely on.hie
files and hence depends onghc
!)
One could even imagine people who build their Haskell with alternative systems like shake
might use a cabal.project
to get the shake
binaries in the first place.