better names.

This commit is contained in:
Kazu Yamamoto 2014-04-28 21:59:54 +09:00
parent a1aa44bdbb
commit d007fa817a

View File

@ -48,7 +48,7 @@ appendLogRef df (LogRef ref) _ sev src style msg = do
-- executes a body. Log messages are returned as 'String'. -- executes a body. Log messages are returned as 'String'.
-- Right is success and Left is failure. -- Right is success and Left is failure.
withLogger :: Options -> (DynFlags -> DynFlags) -> Ghc () -> Ghc (Either String String) withLogger :: Options -> (DynFlags -> DynFlags) -> Ghc () -> Ghc (Either String String)
withLogger opt setDF body = ghandle (handleErrMsg opt) $ do withLogger opt setDF body = ghandle (sourceError opt) $ do
logref <- liftIO $ newLogRef logref <- liftIO $ newLogRef
withDynFlags (setLogger logref . setDF) $ do withDynFlags (setLogger logref . setDF) $ do
body body
@ -59,8 +59,8 @@ withLogger opt setDF body = ghandle (handleErrMsg opt) $ do
---------------------------------------------------------------- ----------------------------------------------------------------
-- | Converting 'SourceError' to 'String'. -- | Converting 'SourceError' to 'String'.
handleErrMsg :: Options -> SourceError -> Ghc (Either String String) sourceError :: Options -> SourceError -> Ghc (Either String String)
handleErrMsg opt err = do sourceError opt err = do
dflag <- G.getSessionDynFlags dflag <- G.getSessionDynFlags
style <- getStyle style <- getStyle
let ret = convert opt . errBagToStrList dflag style . srcErrorMessages $ err let ret = convert opt . errBagToStrList dflag style . srcErrorMessages $ err