This commit is contained in:
Kazu Yamamoto 2014-04-28 21:51:39 +09:00
parent 913fb72911
commit a1aa44bdbb
2 changed files with 6 additions and 1 deletions

View File

@ -152,7 +152,7 @@ addCmdOpts cmdOpts df =
----------------------------------------------------------------
-- | Set the files and load
-- | Set the files as targets and load them.
setTargetFiles :: (GhcMonad m) => [FilePath] -> m ()
setTargetFiles files = do
targets <- forM files $ \file -> G.guessTarget file Nothing
@ -178,9 +178,11 @@ withDynFlags setFlag body = G.gbracket setup teardown (\_ -> body)
----------------------------------------------------------------
-- | Set 'DynFlags' equivalent to "-w:".
setNoWaringFlags :: DynFlags -> DynFlags
setNoWaringFlags df = df { warningFlags = Gap.emptyWarnFlags}
-- | Set 'DynFlags' equivalent to "-Wall".
setAllWaringFlags :: DynFlags -> DynFlags
setAllWaringFlags df = df { warningFlags = allWarningFlags }

View File

@ -44,6 +44,9 @@ appendLogRef df (LogRef ref) _ sev src style msg = do
----------------------------------------------------------------
-- | Set the session flag (e.g. "-Wall" or "-w:") then
-- executes a body. Log messages are returned as 'String'.
-- Right is success and Left is failure.
withLogger :: Options -> (DynFlags -> DynFlags) -> Ghc () -> Ghc (Either String String)
withLogger opt setDF body = ghandle (handleErrMsg opt) $ do
logref <- liftIO $ newLogRef