Merge branch 'master' of git://github.com/mvoidex/ghc-mod into mvoidex-master

Conflicts:
	Language/Haskell/GhcMod/List.hs
This commit is contained in:
Kazu Yamamoto 2013-10-29 11:32:06 +09:00
commit dfecb22123
2 changed files with 12 additions and 5 deletions

View File

@ -13,14 +13,21 @@ import UniqFM
-- | Listing installed modules.
listModules :: Options -> Cradle -> IO String
listModules opt cradle = convert opt . nub . sort <$> withGHCDummyFile (listMods opt cradle)
listModules opt cradle = convert opt . nub . sort . map dropPkgs <$> withGHCDummyFile (listMods opt cradle)
where
dropPkgs (name, pkg)
| detailed opt = name ++ " " ++ pkg
| otherwise = name
-- | Listing installed modules.
listMods :: Options -> Cradle -> Ghc [String]
listMods :: Options -> Cradle -> Ghc [(String, String)]
listMods opt cradle = do
void $ initializeFlagsWithCradle opt cradle [] False
getExposedModules <$> getSessionDynFlags
where
getExposedModules = map moduleNameString
. concatMap exposedModules
getExposedModules = concatMap exposedModules'
. eltsUFM . pkgIdMap . pkgState
exposedModules' p =
map moduleNameString (exposedModules p)
`zip`
repeat (display $ sourcePackageId p)

View File

@ -24,7 +24,7 @@ ghcOptHelp = " [-g GHC_opt1 -g GHC_opt2 ...] "
usage :: String
usage = "ghc-mod version " ++ showVersion version ++ "\n"
++ "Usage:\n"
++ "\t ghc-mod list" ++ ghcOptHelp ++ "[-l]\n"
++ "\t ghc-mod list" ++ ghcOptHelp ++ "[-l] [-d]\n"
++ "\t ghc-mod lang [-l]\n"
++ "\t ghc-mod flag [-l]\n"
++ "\t ghc-mod browse" ++ ghcOptHelp ++ "[-l] [-o] [-d] <module> [<module> ...]\n"