ad55168265
These command line options work just like the similar-named GHC flags. They are useful when working with non-standard package databases.
23 lines
568 B
Haskell
23 lines
568 B
Haskell
module List (listModules) where
|
|
|
|
import Control.Applicative
|
|
import Data.List
|
|
import GHC
|
|
import Packages
|
|
import Types
|
|
import UniqFM
|
|
|
|
----------------------------------------------------------------
|
|
|
|
listModules :: Options -> IO String
|
|
listModules opt = convert opt . nub . sort <$> list opt
|
|
|
|
list :: Options -> IO [String]
|
|
list opt = withGHC $ do
|
|
initSession0 opt
|
|
getExposedModules <$> getSessionDynFlags
|
|
where
|
|
getExposedModules = map moduleNameString
|
|
. concatMap exposedModules
|
|
. eltsUFM . pkgIdMap . pkgState
|