There is already a default GHC environment that GHC and GHCi will use outside of cabal packages. You can use the (dreaded) cabal install --lib
command to add packages to that environment, however it’s quite easy to get conflicts and it is hard to remove packages from an environment. See 5.2. Commands — Cabal 3.10.1.0 User's Guide and 5.9. Packages — Glasgow Haskell Compiler 9.6.1 User's Guide.
One issue with including packages by default in build-depends
fields is that .cabal
files are supposed to be completely static descriptions of your package, so it should list all dependencies explicitly. One thing that cabal could do is to add a default set of packages when initializing a new package with cabal init
.
I think the last point about cabal repl
loading the global default packages would be easier to improve but only when cabal repl
is called outside cabal projects. When called outside a project it will create a dummy project with some default configuration which I assume could be easily extended with the global default set of packages.