refactoring.
This commit is contained in:
parent
9c7c6a5cf9
commit
98d3c7028c
@ -55,7 +55,7 @@ expandTemplate opt cradle files = withGHC sessionName $ do
|
|||||||
sessionName = case files of
|
sessionName = case files of
|
||||||
[file] -> file
|
[file] -> file
|
||||||
_ -> "MultipleFiles"
|
_ -> "MultipleFiles"
|
||||||
options = "-w:" : ghcOpts opt
|
options = noWaringOption : ghcOpts opt
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ module Language.Haskell.GhcMod.GHCApi (
|
|||||||
, getDynamicFlags
|
, getDynamicFlags
|
||||||
, getSystemLibDir
|
, getSystemLibDir
|
||||||
, withDynFlags
|
, withDynFlags
|
||||||
|
, noWaringOption
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Language.Haskell.GhcMod.CabalApi
|
import Language.Haskell.GhcMod.CabalApi
|
||||||
@ -180,3 +181,9 @@ withDynFlags setFlag body = G.gbracket setup teardown (\_ -> body)
|
|||||||
void $ G.setSessionDynFlags (setFlag dflag)
|
void $ G.setSessionDynFlags (setFlag dflag)
|
||||||
return dflag
|
return dflag
|
||||||
teardown = void . G.setSessionDynFlags
|
teardown = void . G.setSessionDynFlags
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
-- probably this is not necessary anymore.
|
||||||
|
noWaringOption :: String
|
||||||
|
noWaringOption = "-w:"
|
||||||
|
@ -29,9 +29,6 @@ import Language.Haskell.GhcMod.Types
|
|||||||
import Outputable (PprStyle)
|
import Outputable (PprStyle)
|
||||||
import TcHsSyn (hsPatType)
|
import TcHsSyn (hsPatType)
|
||||||
|
|
||||||
noWaringOptions :: [String]
|
|
||||||
noWaringOptions = ["-w:"]
|
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
-- | Obtaining information of a target expression. (GHCi's info:)
|
-- | Obtaining information of a target expression. (GHCi's info:)
|
||||||
@ -41,7 +38,7 @@ infoExpr :: Options
|
|||||||
-> Expression -- ^ A Haskell expression.
|
-> Expression -- ^ A Haskell expression.
|
||||||
-> IO String
|
-> IO String
|
||||||
infoExpr opt cradle file expr = withGHC' $ do
|
infoExpr opt cradle file expr = withGHC' $ do
|
||||||
initializeFlagsWithCradle opt cradle noWaringOptions
|
initializeFlagsWithCradle opt cradle [noWaringOption]
|
||||||
info opt file expr
|
info opt file expr
|
||||||
|
|
||||||
-- | Obtaining information of a target expression. (GHCi's info:)
|
-- | Obtaining information of a target expression. (GHCi's info:)
|
||||||
@ -79,7 +76,7 @@ typeExpr :: Options
|
|||||||
-> Int -- ^ Column number.
|
-> Int -- ^ Column number.
|
||||||
-> IO String
|
-> IO String
|
||||||
typeExpr opt cradle file lineNo colNo = withGHC' $ do
|
typeExpr opt cradle file lineNo colNo = withGHC' $ do
|
||||||
initializeFlagsWithCradle opt cradle noWaringOptions
|
initializeFlagsWithCradle opt cradle [noWaringOption]
|
||||||
types opt file lineNo colNo
|
types opt file lineNo colNo
|
||||||
|
|
||||||
-- | Obtaining type of a target expression. (GHCi's type:)
|
-- | Obtaining type of a target expression. (GHCi's type:)
|
||||||
|
Loading…
Reference in New Issue
Block a user