Force the result of user-defined commands
[ghc-hetmet.git] / compiler / main / Finder.lhs
index bbea77d..500e36e 100644 (file)
@@ -37,7 +37,7 @@ import FiniteMap
 import LazyUniqFM
 import Maybes          ( expectJust )
 
-import Distribution.Package
+import Distribution.Package hiding (PackageId)
 import Data.IORef      ( IORef, writeIORef, readIORef, modifyIORef )
 import Data.List
 import System.Directory
@@ -570,14 +570,8 @@ cantFindErr cannot_find dflags mod_name find_result
            NotFound files mb_pkg
                | null files
                -> ptext (sLit "it is not a module in the current program, or in any known package.")
-               | Just pkg <- mb_pkg, pkg /= thisPackage dflags, build_tag /= ""
-               -> let 
-                    build = if build_tag == "p" then "profiling" 
-                                                else "\"" ++ build_tag ++ "\""
-                  in
-                  ptext (sLit "Perhaps you haven't installed the ") <> text build <>
-                  ptext (sLit " libraries for package ") <> ppr pkg <> char '?' $$
-                  not_found files
+               | Just pkg <- mb_pkg, pkg /= thisPackage dflags
+               -> not_found_in_package pkg files
 
                | otherwise
                -> not_found files
@@ -589,6 +583,22 @@ cantFindErr cannot_find dflags mod_name find_result
 
     build_tag = buildTag dflags
 
+    not_found_in_package pkg files
+       | build_tag /= ""
+       = let
+            build = if build_tag == "p" then "profiling"
+                                        else "\"" ++ build_tag ++ "\""
+         in
+         ptext (sLit "Perhaps you haven't installed the ") <> text build <>
+         ptext (sLit " libraries for package ") <> ppr pkg <> char '?' $$
+         not_found files
+
+       | otherwise
+       = ptext (sLit "There are files missing in the ") <> ppr pkg <>
+         ptext (sLit " package,") $$
+         ptext (sLit "try running 'ghc-pkg check'.") $$
+         not_found files
+
     not_found files
        | verbosity dflags < 3
        = ptext (sLit "Use -v to see a list of the files searched for.")