24 lines
594 B
Haskell
24 lines
594 B
Haskell
module List (listModules) where
|
|
|
|
import Control.Applicative
|
|
import Data.List
|
|
import GHC
|
|
import GHCApi
|
|
import Packages
|
|
import Types
|
|
import UniqFM
|
|
|
|
----------------------------------------------------------------
|
|
|
|
listModules :: Options -> IO String
|
|
listModules opt = convert opt . nub . sort <$> list opt
|
|
|
|
list :: Options -> IO [String]
|
|
list opt = withGHCDummyFile $ do
|
|
initializeFlags opt
|
|
getExposedModules <$> getSessionDynFlags
|
|
where
|
|
getExposedModules = map moduleNameString
|
|
. concatMap exposedModules
|
|
. eltsUFM . pkgIdMap . pkgState
|