[commit: ghc] master: Improve error message when importing an unusable package (df0f148)

git at git.haskell.org git at git.haskell.org
Sun Jun 17 16:42:14 UTC 2018


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

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

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

commit df0f148feae4c3b9653260edff843d561d6d5918
Author: Sean D Gillespie <sean at mistersg.net>
Date:   Sun Jun 17 11:22:20 2018 -0400

    Improve error message when importing an unusable package
    
    If a module cannot be found because it is ignored or from an unusable
    package, report this to the user and the reason it is unusable.
    
    Currently, GHC displays the standard "Cannot find module error". For
    example:
    
    ```
    <no location info>: error:
        Could not find module ‘Control.Monad.Random’
        Perhaps you meant
          Control.Monad.Reader (from mtl-2.2.2)
          Control.Monad.Cont (from mtl-2.2.2)
          Control.Monad.Error (from mtl-2.2.2)
    ```
    
    GHC does, however, indicate unusable/ignored packages with the -v flag:
    
    ```
    package MonadRandom-0.5.1-1421RgpXdhC8e8UI7D3emA is unusable due to
    missing dependencies:
      fail-4.9.0.0-BAHmj60kS5K7NVhhKpm9J5
    ```
    
    With this change, I took that message and added it to the output of the
    "Cannot find module" message.
    
    Reviewers: bgamari, dfeuer
    
    Reviewed By: bgamari
    
    Subscribers: Phyx, dfeuer, rwbarton, thomie, carter
    
    GHC Trac Issues: #4806
    
    Differential Revision: https://phabricator.haskell.org/D4783


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

df0f148feae4c3b9653260edff843d561d6d5918
 compiler/main/Finder.hs                        | 61 ++++++++++++----
 compiler/main/HscTypes.hs                      |  3 +
 compiler/main/Packages.hs                      | 96 ++++++++++++++++++++------
 testsuite/tests/ghci/should_fail/T15055.stderr |  4 +-
 testsuite/tests/package/T4806.hs               |  1 +
 testsuite/tests/package/T4806.stderr           |  6 ++
 testsuite/tests/package/T4806a.hs              |  1 +
 testsuite/tests/package/T4806a.stderr          |  7 ++
 testsuite/tests/package/all.T                  |  3 +
 testsuite/tests/package/package01e.stderr      |  4 +-
 testsuite/tests/package/package06e.stderr      |  8 +--
 testsuite/tests/package/package07e.stderr      |  6 +-
 testsuite/tests/package/package08e.stderr      |  6 +-
 testsuite/tests/plugins/T11244.stderr          |  2 +-
 14 files changed, 161 insertions(+), 47 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 df0f148feae4c3b9653260edff843d561d6d5918


More information about the ghc-commits mailing list