[GHC] #13753: Improve GHC's ghc package environment lookup logic

GHC ghc-devs at haskell.org
Thu May 25 12:04:50 UTC 2017


#13753: Improve GHC's ghc package environment lookup logic
-------------------------------------+-------------------------------------
           Reporter:  hvr            |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:  8.2.2
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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:

  1. 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.

  2. 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).

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13753>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list