[GHC] #9375: Support for module thinning/renaming on command line

GHC ghc-devs at haskell.org
Tue Aug 5 10:15:26 UTC 2014


#9375: Support for module thinning/renaming on command line
-------------------------------------+-------------------------------------
              Reporter:  ezyang      |            Owner:  ezyang
                  Type:  feature     |           Status:  new
  request                            |        Milestone:
              Priority:  normal      |          Version:  7.8.2
             Component:  Package     |         Keywords:  backpack
  system                             |     Architecture:  Unknown/Multiple
            Resolution:              |       Difficulty:  Unknown
      Operating System:              |       Blocked By:
  Unknown/Multiple                   |  Related Tickets:
       Type of failure:              |
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by Edward Z. Yang <ezyang@…>):

 In [changeset:"207875293fea07aa90efe215369629b657d1875a/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="207875293fea07aa90efe215369629b657d1875a"
 Thinning and renaming modules from packages on the command line.

 Summary:
 This patch set adds support for extra syntax on -package and related
 arguments which allow you to thin and rename modules from a package.
 For example, this argument:

     -package "base (Data.Bool as Bam, Data.List)"

 adds two more modules into scope, Bam and Data.List, without adding
 any of base's other modules to scope.

 These flags are additive: so, for example, saying:

     -hide-all-packages -package base -package "base (Data.Bool as Bam)"

 will provide both the normal bindings for modules in base, as well as
 the module Bam.

 There is also a new debug flag -ddump-mod-map which prints the state
 of the module mapping database.  H = hidden, E = exposed (so for
 example EH says the module in question is exported, but in a hidden
 package.)

 Module suggestions have been minorly overhauled to work better with
 reexports:
 if you have -package "base (Data.Bool as Bam)" and mispell Bam, GHC
 will suggest "Did you mean Bam (defined via package flags to be
 base:Data.Bool)"; and generally you will get more accurate information.
 Also, fix a bug where we suggest the -package flag when we really need
 the -package-key flag.

 NB: The renaming afforded here does *not* affect what wired in
 symbols GHC generates.  (But it does affect implicit prelude!)

 ToDo: add 'hiding' functionality, to make it easier to support the
 alternative
 prelude use-case.

 ToDo: Cabal support

 Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>

 Test Plan: new tests and validate

 Reviewers: simonpj, simonmar, hvr, austin

 Subscribers: simonmar, relrod, ezyang, carter

 Differential Revision: https://phabricator.haskell.org/D113

 GHC Trac Issues: #9375
 }}}

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


More information about the ghc-tickets mailing list