From 000076223f460cce3f991f16de2271de5c4c8639 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Mon, 28 Apr 2014 13:00:25 +0900 Subject: [PATCH] removing the third argument from initializeFlagsWithCradle. --- Language/Haskell/GhcMod/Browse.hs | 2 +- Language/Haskell/GhcMod/Check.hs | 4 ++-- Language/Haskell/GhcMod/Find.hs | 2 +- Language/Haskell/GhcMod/GHCApi.hs | 4 ++-- Language/Haskell/GhcMod/Info.hs | 4 ++-- Language/Haskell/GhcMod/List.hs | 2 +- src/GHCModi.hs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Language/Haskell/GhcMod/Browse.hs b/Language/Haskell/GhcMod/Browse.hs index 729c2ee..2026cd8 100644 --- a/Language/Haskell/GhcMod/Browse.hs +++ b/Language/Haskell/GhcMod/Browse.hs @@ -32,7 +32,7 @@ browseModule :: Options -> ModuleString -- ^ A module name. (e.g. \"Data.List\") -> IO String browseModule opt cradle pkgmdl = withGHC' $ do - initializeFlagsWithCradle opt cradle [] + initializeFlagsWithCradle opt cradle browse opt pkgmdl -- | Getting functions, classes, etc from a module. diff --git a/Language/Haskell/GhcMod/Check.hs b/Language/Haskell/GhcMod/Check.hs index 0f32997..47d3205 100644 --- a/Language/Haskell/GhcMod/Check.hs +++ b/Language/Haskell/GhcMod/Check.hs @@ -22,7 +22,7 @@ checkSyntax :: Options -> IO String checkSyntax _ _ [] = return "" checkSyntax opt cradle files = withGHC sessionName $ do - initializeFlagsWithCradle opt cradle (ghcOpts opt) + initializeFlagsWithCradle opt cradle check opt files where sessionName = case files of @@ -48,7 +48,7 @@ expandTemplate :: Options -> IO String expandTemplate _ _ [] = return "" expandTemplate opt cradle files = withGHC sessionName $ do - initializeFlagsWithCradle opt cradle (ghcOpts opt) + initializeFlagsWithCradle opt cradle expand opt files where sessionName = case files of diff --git a/Language/Haskell/GhcMod/Find.hs b/Language/Haskell/GhcMod/Find.hs index e35604e..0a40927 100644 --- a/Language/Haskell/GhcMod/Find.hs +++ b/Language/Haskell/GhcMod/Find.hs @@ -33,7 +33,7 @@ newtype SymMdlDb = SymMdlDb (Map Symbol [ModuleString]) -- | Find modules to which the symbol belong. findSymbol :: Options -> Cradle -> Symbol -> IO String findSymbol opt cradle sym = withGHC' $ do - initializeFlagsWithCradle opt cradle [] + initializeFlagsWithCradle opt cradle lookupSym opt sym <$> getSymMdlDb -- | Creating 'SymMdlDb'. diff --git a/Language/Haskell/GhcMod/GHCApi.hs b/Language/Haskell/GhcMod/GHCApi.hs index b1011d4..e7b460f 100644 --- a/Language/Haskell/GhcMod/GHCApi.hs +++ b/Language/Haskell/GhcMod/GHCApi.hs @@ -76,14 +76,14 @@ data Build = CabalPkg | SingleFile deriving Eq initializeFlagsWithCradle :: GhcMonad m => Options -> Cradle - -> [GHCOption] -> m () -initializeFlagsWithCradle opt cradle ghcopts +initializeFlagsWithCradle opt cradle | cabal = withCabal |||> withSandbox | otherwise = withSandbox where mCradleFile = cradleCabalFile cradle cabal = isJust mCradleFile + ghcopts = ghcOpts opt withCabal = do pkgDesc <- liftIO $ parseCabalFile $ fromJust mCradleFile compOpts <- liftIO $ getCompilerOptions ghcopts cradle pkgDesc diff --git a/Language/Haskell/GhcMod/Info.hs b/Language/Haskell/GhcMod/Info.hs index c73716a..25dc417 100644 --- a/Language/Haskell/GhcMod/Info.hs +++ b/Language/Haskell/GhcMod/Info.hs @@ -37,7 +37,7 @@ infoExpr :: Options -> Expression -- ^ A Haskell expression. -> IO String infoExpr opt cradle file expr = withGHC' $ do - initializeFlagsWithCradle opt cradle [] + initializeFlagsWithCradle opt cradle info opt file expr -- | Obtaining information of a target expression. (GHCi's info:) @@ -73,7 +73,7 @@ typeExpr :: Options -> Int -- ^ Column number. -> IO String typeExpr opt cradle file lineNo colNo = withGHC' $ do - initializeFlagsWithCradle opt cradle [] + initializeFlagsWithCradle opt cradle types opt file lineNo colNo -- | Obtaining type of a target expression. (GHCi's type:) diff --git a/Language/Haskell/GhcMod/List.hs b/Language/Haskell/GhcMod/List.hs index 44188df..b2ce287 100644 --- a/Language/Haskell/GhcMod/List.hs +++ b/Language/Haskell/GhcMod/List.hs @@ -15,7 +15,7 @@ import UniqFM (eltsUFM) -- | Listing installed modules. listModules :: Options -> Cradle -> IO String listModules opt cradle = withGHC' $ do - initializeFlagsWithCradle opt cradle [] + initializeFlagsWithCradle opt cradle modules opt -- | Listing installed modules. diff --git a/src/GHCModi.hs b/src/GHCModi.hs index 618703a..c71ffa0 100644 --- a/src/GHCModi.hs +++ b/src/GHCModi.hs @@ -122,7 +122,7 @@ replace (x:xs) = x : replace xs run :: Cradle -> Maybe FilePath -> Options -> Ghc a -> IO a run cradle mlibdir opt body = G.runGhc mlibdir $ do - initializeFlagsWithCradle opt cradle [] + initializeFlagsWithCradle opt cradle dflags <- G.getSessionDynFlags G.defaultCleanupHandler dflags body