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

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Sun May 13 11:52:35 UTC 2018

Brandon Allbery wrote:
> The whole point of them is to enable doing things that no tooling can
> sanely automate, enabling the environment from those builds to be available
> to do those things.

I think the complaint is not about the functionality at all, but about
the fact that this environment information is picked up implicitly.
This is exacerbated by the fact that the resulting diagnostic messages
are poor.

>From my own perspective, I expect that changing the working directory
does not change the behavior of ghci except for where it looks for
source code. This is somewhat broken by .ghci files, but one can opt
out of these; ideally I'd like local .ghci files to be opt in, and
only $HOME/.ghci be parsed by default.

So that's what I would advocate: ghc's functionality to use these local
(CWD-based) environment files should be disabled by default and enabled
by a command line switch. It's unfortunate that this functionality has
been present since ghc 8.0 but has gone unnoticed until now that
cabal-install actually uses it, so cabal-install gets most of the blame.

But at the very least it should be easy to opt out of this functionality.
So https://ghc.haskell.org/trac/ghc/ticket/13753 will help.



More information about the Haskell-Cafe mailing list