emit a helpful error message for missing DPH packages
[ghc-hetmet.git] / compiler / main / Packages.lhs
index a940f99..ff316aa 100644 (file)
@@ -359,6 +359,15 @@ comparing f a b = f a `compare` f b
 packageFlagErr :: PackageFlag
                -> [(PackageConfig, UnusablePackageReason)]
                -> IO a
+
+-- for missing DPH package we emit a more helpful error message, because
+-- this may be the result of using -fdph-par or -fdph-seq.
+packageFlagErr (ExposePackage pkg) [] | is_dph_package pkg
+  = ghcError (CmdLineError (showSDoc $ dph_err))
+  where dph_err = text "the " <> text pkg <> text " package is not installed."
+                  $$ text "To install it: \"cabal install dph\"."
+        is_dph_package pkg = "dph" `isPrefixOf` pkg
+  
 packageFlagErr flag reasons = ghcError (CmdLineError (showSDoc $ err))
   where err = text "cannot satisfy " <> ppr_flag <> 
                 (if null reasons then empty else text ": ") $$
@@ -947,6 +956,9 @@ missingDependencyMsg (Just parent)
 
 -- | Will the 'Name' come from a dynamically linked library?
 isDllName :: PackageId -> Name -> Bool
+-- Despite the "dll", I think this function just means that
+-- the synbol comes from another dynamically-linked package,
+-- and applies on all platforms, not just Windows
 isDllName this_pkg name
   | opt_Static = False
   | Just mod <- nameModule_maybe name = modulePackageId mod /= this_pkg