From 98d3c7028ce40b01dddb530a447b12ae49a617e8 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Sat, 26 Apr 2014 22:51:29 +0900 Subject: [PATCH] refactoring. --- Language/Haskell/GhcMod/Check.hs | 2 +- Language/Haskell/GhcMod/GHCApi.hs | 7 +++++++ Language/Haskell/GhcMod/Info.hs | 7 ++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Language/Haskell/GhcMod/Check.hs b/Language/Haskell/GhcMod/Check.hs index c4fd239..88a547b 100644 --- a/Language/Haskell/GhcMod/Check.hs +++ b/Language/Haskell/GhcMod/Check.hs @@ -55,7 +55,7 @@ expandTemplate opt cradle files = withGHC sessionName $ do sessionName = case files of [file] -> file _ -> "MultipleFiles" - options = "-w:" : ghcOpts opt + options = noWaringOption : ghcOpts opt ---------------------------------------------------------------- diff --git a/Language/Haskell/GhcMod/GHCApi.hs b/Language/Haskell/GhcMod/GHCApi.hs index 43c516b..888b78c 100644 --- a/Language/Haskell/GhcMod/GHCApi.hs +++ b/Language/Haskell/GhcMod/GHCApi.hs @@ -9,6 +9,7 @@ module Language.Haskell.GhcMod.GHCApi ( , getDynamicFlags , getSystemLibDir , withDynFlags + , noWaringOption ) where import Language.Haskell.GhcMod.CabalApi @@ -180,3 +181,9 @@ withDynFlags setFlag body = G.gbracket setup teardown (\_ -> body) void $ G.setSessionDynFlags (setFlag dflag) return dflag teardown = void . G.setSessionDynFlags + +---------------------------------------------------------------- + +-- probably this is not necessary anymore. +noWaringOption :: String +noWaringOption = "-w:" diff --git a/Language/Haskell/GhcMod/Info.hs b/Language/Haskell/GhcMod/Info.hs index bae6573..3b6d1c9 100644 --- a/Language/Haskell/GhcMod/Info.hs +++ b/Language/Haskell/GhcMod/Info.hs @@ -29,9 +29,6 @@ import Language.Haskell.GhcMod.Types import Outputable (PprStyle) import TcHsSyn (hsPatType) -noWaringOptions :: [String] -noWaringOptions = ["-w:"] - ---------------------------------------------------------------- -- | Obtaining information of a target expression. (GHCi's info:) @@ -41,7 +38,7 @@ infoExpr :: Options -> Expression -- ^ A Haskell expression. -> IO String infoExpr opt cradle file expr = withGHC' $ do - initializeFlagsWithCradle opt cradle noWaringOptions + initializeFlagsWithCradle opt cradle [noWaringOption] info opt file expr -- | Obtaining information of a target expression. (GHCi's info:) @@ -79,7 +76,7 @@ typeExpr :: Options -> Int -- ^ Column number. -> IO String typeExpr opt cradle file lineNo colNo = withGHC' $ do - initializeFlagsWithCradle opt cradle noWaringOptions + initializeFlagsWithCradle opt cradle [noWaringOption] types opt file lineNo colNo -- | Obtaining type of a target expression. (GHCi's type:)