Commit 29f84d30 authored by Duncan Coutts's avatar Duncan Coutts Committed by Edward Z. Yang

Fix long lines and trailing whitespace

in the previous patches in this series
parent 6930a88c
......@@ -1117,7 +1117,8 @@ linkPackage dflags pkg
objs = [ obj | Object obj <- classifieds ]
archs = [ arch | Archive arch <- classifieds ]
maybePutStr dflags ("Loading package " ++ sourcePackageIdString pkg ++ " ... ")
maybePutStr dflags
("Loading package " ++ sourcePackageIdString pkg ++ " ... ")
-- See comments with partOfGHCi
when (packageName pkg `notElem` partOfGHCi) $ do
......@@ -1132,8 +1133,11 @@ linkPackage dflags pkg
maybePutStr dflags "linking ... "
ok <- resolveObjs
if succeeded ok then maybePutStrLn dflags "done."
else throwGhcExceptionIO (InstallationError ("unable to load package `" ++ sourcePackageIdString pkg ++ "'"))
if succeeded ok
then maybePutStrLn dflags "done."
else let errmsg = "unable to load package `"
++ sourcePackageIdString pkg ++ "'"
in throwGhcExceptionIO (InstallationError errmsg)
-- we have already searched the filesystem; the strings passed to load_dyn
-- can be passed directly to loadDLL. They are either fully-qualified
......
......@@ -616,13 +616,14 @@ cantFindErr cannot_find _ dflags mod_name find_result
hang (ptext (sLit "Locations searched:")) 2 $ vcat (map text files)
pkg_hidden pkgid =
ptext (sLit "It is a member of the hidden package") <+> quotes (ppr pkgid)
ptext (sLit "It is a member of the hidden package")
<+> quotes (ppr pkgid)
--FIXME: we don't really want to show the package key here we should
-- show the source package id or installed package id if it's ambiguous
<> dot $$ cabal_pkg_hidden_hint pkgid
cabal_pkg_hidden_hint pkgid
| gopt Opt_BuildingCabalPackage dflags
= let pkg = expectJust "cabal_pkg_hidden_hint" (lookupPackage dflags pkgid)
= let pkg = expectJust "pkg_hidden" (lookupPackage dflags pkgid)
in ptext (sLit "Perhaps you need to add") <+>
quotes (ppr (packageName pkg)) <+>
ptext (sLit "to the build-depends in your .cabal file.")
......
......@@ -68,7 +68,7 @@ instance BinaryStringRep PackageKey where
instance BinaryStringRep Module.ModuleName where
fromStringRep = Module.mkModuleName . BS.unpack
toStringRep = BS.pack . Module.moduleNameString
toStringRep = BS.pack . Module.moduleNameString
instance Outputable InstalledPackageId where
ppr (InstalledPackageId str) = text str
......
......@@ -391,9 +391,10 @@ readPackageConfig dflags conf_file = do
isfile <- doesFileExist conf_file
if isfile
then throwGhcExceptionIO $ InstallationError $
"ghc no longer supports single-file style package databases (" ++
conf_file ++
") use 'ghc-pkg init' to create the database with the correct format."
"ghc no longer supports single-file style package " ++
"databases (" ++ conf_file ++
") use 'ghc-pkg init' to create the database with " ++
"the correct format."
else throwGhcExceptionIO $ InstallationError $
"can't find a package database at " ++ conf_file
......@@ -597,7 +598,8 @@ packageFlagErr dflags flag reasons
-- ToDo: this admonition seems a bit dodgy
text "(use -v for more information)")
ppr_reasons = vcat (map ppr_reason reasons)
ppr_reason (p, reason) = pprReason (ppr (installedPackageId p) <+> text "is") reason
ppr_reason (p, reason) =
pprReason (ppr (installedPackageId p) <+> text "is") reason
pprFlag :: PackageFlag -> SDoc
pprFlag flag = case flag of
......@@ -692,7 +694,9 @@ findWiredInPackages dflags pkgs = do
updateWiredInDependencies pkgs = map upd_pkg pkgs
where upd_pkg pkg
| installedPackageId pkg `elem` wired_in_ids
= pkg { packageKey = stringToPackageKey (packageNameString pkg) }
= pkg {
packageKey = stringToPackageKey (packageNameString pkg)
}
| otherwise
= pkg
......
......@@ -34,7 +34,7 @@
-- the second version -- the bit GHC uses -- and the part managed by ghc-pkg
-- is kept in the file but here we treat it as an opaque blob of data. That way
-- this library avoids depending on Cabal.
--
--
module GHC.PackageDb (
InstalledPackageInfo(..),
ModuleExport(..),
......@@ -106,7 +106,8 @@ data ModuleExport instpkgid modulename
}
deriving (Eq, Show)
emptyInstalledPackageInfo :: (BinaryStringRep a, BinaryStringRep b, BinaryStringRep c, BinaryStringRep d)
emptyInstalledPackageInfo :: (BinaryStringRep a, BinaryStringRep b,
BinaryStringRep c, BinaryStringRep d)
=> InstalledPackageInfo a b c d e
emptyInstalledPackageInfo =
InstalledPackageInfo {
......@@ -230,17 +231,17 @@ decodeFromFile file decoder =
withBinaryFile file ReadMode $ \hnd ->
feed hnd (runGetIncremental decoder)
where
feed hnd (Partial k) = do chunk <- BS.hGet hnd BS.Lazy.defaultChunkSize
if BS.null chunk
then feed hnd (k Nothing)
else feed hnd (k (Just chunk))
feed _ (Done _ _ result) = return result
feed _ (Fail _ _ msg) = ioError err
feed hnd (Partial k) = do chunk <- BS.hGet hnd BS.Lazy.defaultChunkSize
if BS.null chunk
then feed hnd (k Nothing)
else feed hnd (k (Just chunk))
feed _ (Done _ _ res) = return res
feed _ (Fail _ _ msg) = ioError err
where
err = mkIOError InappropriateType loc Nothing (Just file)
`ioeSetErrorString` msg
loc = "GHC.PackageDb.readPackageDb"
writeFileAtomic :: FilePath -> BS.Lazy.ByteString -> IO ()
writeFileAtomic targetPath content = do
let (targetDir, targetName) = splitFileName targetPath
......@@ -272,7 +273,8 @@ instance (BinaryStringRep a, BinaryStringRep b, BinaryStringRep c,
BinaryStringRep d, BinaryStringRep e) =>
Binary (InstalledPackageInfo a b c d e) where
put (InstalledPackageInfo
installedPackageId sourcePackageId packageName packageVersion packageKey
installedPackageId sourcePackageId
packageName packageVersion packageKey
depends importDirs
hsLibraries extraLibraries extraGHCiLibraries libraryDirs
frameworks frameworkDirs
......@@ -357,7 +359,8 @@ instance Binary Version where
b <- get
return (Version a b)
instance (BinaryStringRep a, BinaryStringRep b) => Binary (ModuleExport a b) where
instance (BinaryStringRep a, BinaryStringRep b) =>
Binary (ModuleExport a b) where
put (ModuleExport a b c) = do
put (toStringRep a)
put (toStringRep b)
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment