From bb8df8cbdf0b4f43fe128fdb4f2c2d54b7f7db57 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Wed, 30 Apr 2014 10:39:39 +0900 Subject: [PATCH] bootInfo uses boot. --- src/Boot.hs | 16 +++++++--------- src/GHCMod.hs | 2 +- src/GHCModi.hs | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Boot.hs b/src/Boot.hs index 92f7536..877eca9 100644 --- a/src/Boot.hs +++ b/src/Boot.hs @@ -5,17 +5,15 @@ import CoreMonad (liftIO) import GHC (Ghc) import Language.Haskell.GhcMod import Language.Haskell.GhcMod.Ghc +import Language.Haskell.GhcMod.Internal -boot :: Options -> Cradle -> IO String -boot opt cradle = do - mods <- listModules opt cradle - langs <- listLanguages opt - flags <- listFlags opt - pre <- concat <$> mapM (browseModule opt cradle) preBrowsedModules - return $ mods ++ langs ++ flags ++ pre +bootInfo :: Options -> Cradle -> IO String +bootInfo opt cradle = withGHC' $ do + initializeFlagsWithCradle opt cradle + boot opt -boot' :: Options -> Ghc String -boot' opt = do +boot :: Options -> Ghc String +boot opt = do mods <- modules opt langs <- liftIO $ listLanguages opt flags <- liftIO $ listFlags opt diff --git a/src/GHCMod.hs b/src/GHCMod.hs index 17eb70a..5964cf2 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -124,7 +124,7 @@ main = flip E.catches handlers $ do "lint" -> nArgs 1 withFile (lintSyntax opt) cmdArg1 "root" -> rootInfo opt cradle "doc" -> nArgs 1 $ packageDoc opt cradle cmdArg1 - "boot" -> boot opt cradle + "boot" -> bootInfo opt cradle "version" -> return progVersion "help" -> return $ O.usageInfo usage argspec cmd -> E.throw (NoSuchCommand cmd) diff --git a/src/GHCModi.hs b/src/GHCModi.hs index 42ae4d4..ab5d1f6 100644 --- a/src/GHCModi.hs +++ b/src/GHCModi.hs @@ -261,7 +261,7 @@ bootIt :: Options -> Set FilePath -> Ghc (String, Bool, Set FilePath) bootIt opt set = do - ret <- boot' opt + ret <- boot opt return (ret, True, set) browseIt :: Options