[Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files

Wolfgang Jeltsch wolfgang-it at jeltsch.info
Sun May 13 08:53:19 UTC 2018

Am Samstag, den 12.05.2018, 16:41 -0400 schrieb Gershom B:
> There is an important change in the cabal new- commands for 2.2 that
> the release docs should have highlighted more significantly.
> Cabal new-* commands now produce a .ghc.environment file by default.
> These files [1] are picked up by ghc and ghci automatically (since
> 8.0.1), and allow them to operate directly with the same package
> environment used by the new-* commands. This lets you, for example,
> run `ghci` in a project where you are using `new-build` and get the
> proper dependencies in scope. Herbert has written an experimental tool
> to make it easier to create and manipulate these environments [2].

I already had issues with this. I ran some custom tool, which was a
Haskell script, in a directory where I had run cabal new-build before.
As a result, this tool didn’t work, because some module it needed
couldn’t be found. It took me a while to find out what the problem was.

In my opinion, it is questionable that these GHC environment files are
generated by cabal new-build and then influence even Haskell scripts
that have nothing to do with the project at hand.

All the best,

More information about the Haskell-Cafe mailing list