From: Simon Marlow Date: Thu, 15 Jan 2009 12:25:24 +0000 (+0000) Subject: More useful error message when a package .hi file cannot be found: X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=ed73f6871b71202e90ef74d692bc36d796f7e54e More useful error message when a package .hi file cannot be found: > import System.Process Could not find module `System.Process': There are files missing in the process-1.0.1.1 package, try running 'ghc-pkg check'. Use -v to see a list of the files searched for. --- diff --git a/compiler/main/Finder.lhs b/compiler/main/Finder.lhs index 4c6ae29..500e36e 100644 --- a/compiler/main/Finder.lhs +++ b/compiler/main/Finder.lhs @@ -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.")