[commit: ghc] master: Support for multiple signature files in scope. (a7524ea)

git at git.haskell.org git at git.haskell.org
Tue Apr 7 18:55:37 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a7524eaed33324e2155c47d4a705bef1d70a2b5b/ghc

>---------------------------------------------------------------

commit a7524eaed33324e2155c47d4a705bef1d70a2b5b
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Tue Oct 7 20:54:54 2014 -0700

    Support for multiple signature files in scope.
    
    Summary:
    A common pattern when programming with signatures is to combine multiple
    signatures together (signature linking).  We achieve this by making it
    not-an-error to have multiple, distinct interface files for the same module
    name, as long as they have the same backing implementation.  When a user
    imports a module name, they get ALL matching signatures dumped into their
    scope.
    
    On the way, I refactored the module finder code, which now distinguishes
    between exact finds (when you had a 'Module') and regular finds (when
    you had a 'ModuleName').  I also refactored the package finder code to
    use a Monoid instance on LookupResult to collect together various results.
    
    ToDo: At the moment, if a signature is declared in the local package,
    it completely overrides any remote signatures.  Eventually, we'll want
    to also pull in the remote signatures (or even override the local signature,
    if the full implementation is available.)  There are bunch of ToDos in the
    code for what to do once this is done.
    
    ToDo: At the moment, whenever a module name lookup occurs in GHCi and we
    would have seen a signature, we instead continue and return the Module
    for the backing implementation.  This is correct for most cases, but there
    might be some situations where we want something a little more fine-grained
    (e.g. :browse should only list identifiers which are available through
    the in-scope signatures, and not ALL of them.)
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
    
    Test Plan: validate
    
    Reviewers: simonpj, hvr, austin
    
    Subscribers: carter, thomie
    
    Differential Revision: https://phabricator.haskell.org/D790
    
    GHC Trac Issues: #9252


>---------------------------------------------------------------

a7524eaed33324e2155c47d4a705bef1d70a2b5b
 compiler/deSugar/DsMonad.hs                        |   2 +-
 compiler/ghci/Linker.hs                            |  46 +++--
 compiler/iface/LoadIface.hs                        |  18 +-
 compiler/iface/MkIface.hs                          |  18 +-
 compiler/main/DriverMkDepend.hs                    |   5 +-
 compiler/main/DynamicLoading.hs                    |  21 +-
 compiler/main/Finder.hs                            |  77 +++++---
 compiler/main/GHC.hs                               |  30 ++-
 compiler/main/GhcMake.hs                           |  19 +-
 compiler/main/HscTypes.hs                          |  36 +++-
 compiler/main/Packages.hs                          | 212 ++++++++++++++-------
 docs/users_guide/separate_compilation.xml          |   5 +
 ghc/Main.hs                                        |   5 +-
 testsuite/.gitignore                               |   6 +
 testsuite/tests/cabal/sigcabal02/Main.hs           |   7 +
 testsuite/tests/cabal/sigcabal02/Makefile          |  34 ++++
 .../tests/cabal/{cabal05 => sigcabal02}/Setup.hs   |   0
 testsuite/tests/cabal/sigcabal02/ShouldFail.hs     |   1 +
 testsuite/tests/cabal/sigcabal02/all.T             |   9 +
 .../tests/cabal/{cabal05 => sigcabal02}/p/LICENSE  |   0
 testsuite/tests/cabal/sigcabal02/p/Map.hsig        |  18 ++
 testsuite/tests/cabal/sigcabal02/p/P.hs            |  12 ++
 testsuite/tests/cabal/sigcabal02/p/Set.hsig        |  13 ++
 testsuite/tests/cabal/sigcabal02/p/p.cabal         |  14 ++
 .../cabal/{cabal05/p => sigcabal02/q}/LICENSE      |   0
 testsuite/tests/cabal/sigcabal02/q/Map.hsig        |   7 +
 testsuite/tests/cabal/sigcabal02/q/Q.hs            |   7 +
 testsuite/tests/cabal/sigcabal02/q/q.cabal         |  13 ++
 testsuite/tests/cabal/sigcabal02/sigcabal02.stderr |   4 +
 testsuite/tests/cabal/sigcabal02/sigcabal02.stdout |   5 +
 testsuite/tests/driver/recomp014/Makefile          |   4 +-
 testsuite/tests/driver/recomp014/recomp014.stdout  |   1 +
 testsuite/tests/driver/sigof01/Makefile            |   6 +
 testsuite/tests/driver/sigof01/all.T               |  10 +
 testsuite/tests/driver/sigof01/sigof01i.script     |   1 +
 .../sigof01/{sigof01.stdout => sigof01i.stdout}    |   0
 testsuite/tests/driver/sigof01/sigof01i2.script    |   3 +
 testsuite/tests/driver/sigof01/sigof01i2.stdout    |   8 +
 testsuite/tests/package/package09e.stderr          |   2 +-
 39 files changed, 540 insertions(+), 139 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a7524eaed33324e2155c47d4a705bef1d70a2b5b


More information about the ghc-commits mailing list