summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-04-28 21:59:28 +0100
committerIan Lynagh <ian@well-typed.com>2013-04-28 21:59:28 +0100
commit7a310c7b3fab3b18160380a710ee5bbf0c7f1a09 (patch)
treeddda4d29f9ba22af37d3317208843f4f6af41e60 /utils/ghc-pkg
parent0c3a9679286eb96e87905b038bf706734aed3922 (diff)
downloadhaskell-7a310c7b3fab3b18160380a710ee5bbf0c7f1a09.tar.gz
Small refactoring in ghc-pkg
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/Main.hs10
1 files changed, 4 insertions, 6 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 3cda838022..532bc02081 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -1153,17 +1153,15 @@ describeField :: Verbosity -> [Flag] -> PackageArg -> [String] -> Bool -> IO ()
describeField verbosity my_flags pkgarg fields expand_pkgroot = do
(_, _, flag_db_stack) <-
getPkgDatabases verbosity False True{-use cache-} expand_pkgroot my_flags
- fns <- toFields fields
+ fns <- mapM toField fields
ps <- findPackages flag_db_stack pkgarg
mapM_ (selectFields fns) ps
where showFun = if FlagSimpleOutput `elem` my_flags
then showSimpleInstalledPackageInfoField
else showInstalledPackageInfoField
- toFields [] = return []
- toFields (f:fs) = case showFun f of
- Nothing -> die ("unknown field: " ++ f)
- Just fn -> do fns <- toFields fs
- return (fn:fns)
+ toField f = case showFun f of
+ Nothing -> die ("unknown field: " ++ f)
+ Just fn -> return fn
selectFields fns pinfo = mapM_ (\fn->putStrLn (fn pinfo)) fns