Improve GHC's ghc package environment lookup logic
Documentation for package enviroments which describes the current lookup logic: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-environments
There's two things I'd like to improve:
- Define a special magic "null" environment, which instructs GHC to ignore any package environment files.
To this end, I propose to use the name -
(i.e. a single dash), as that is more portable than using the empty string for environment variables. In other words:
-
-package-env -
or -
GHC_ENVIRONMENT=-
(unless a-package-env
flag which has higher priority overrides it)
would prevent GHC from interpreting any package environment files.
- Provide a way to disambiguate environment names (i.e. those that are looked up in
$HOME/.ghc/arch-os-version/environments/name
) and environment files arguments.
Currently, if you say GHC_ENVIRONMENT=test
then a local file test
would shadow the environment named test
which would result in rather confusing errors. Instead I suggest to have package-env identifiers be interpreted as "names" by default, and only if they look like relative or absolute paths (i.e. ./foobar
or /home/foo/...
) be interpreted as file locations (relative to $CWD).
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |