summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Monad.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Driver/Monad.hs')
-rw-r--r--compiler/GHC/Driver/Monad.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/GHC/Driver/Monad.hs b/compiler/GHC/Driver/Monad.hs
index 1a42d8402f..2fa3c51cc1 100644
--- a/compiler/GHC/Driver/Monad.hs
+++ b/compiler/GHC/Driver/Monad.hs
@@ -27,8 +27,8 @@ module GHC.Driver.Monad (
putMsgM,
withTimingM,
- -- ** Warnings
- logWarnings, printException,
+ -- ** Diagnostics
+ logDiagnostics, printException,
WarnErrLogger, defaultWarnErrLogger
) where
@@ -36,7 +36,8 @@ import GHC.Prelude
import GHC.Driver.Session
import GHC.Driver.Env
-import GHC.Driver.Errors ( printOrThrowDiagnostics, printBagOfErrors )
+import GHC.Driver.Errors ( printOrThrowDiagnostics, printMessages )
+import GHC.Driver.Errors.Types
import GHC.Utils.Monad
import GHC.Utils.Exception
@@ -141,10 +142,10 @@ withTimingM doc force action = do
withTiming logger dflags doc force action
-- -----------------------------------------------------------------------------
--- | A monad that allows logging of warnings.
+-- | A monad that allows logging of diagnostics.
-logWarnings :: GhcMonad m => WarningMessages -> m ()
-logWarnings warns = do
+logDiagnostics :: GhcMonad m => Messages GhcMessage -> m ()
+logDiagnostics warns = do
dflags <- getSessionDynFlags
logger <- getLogger
liftIO $ printOrThrowDiagnostics logger dflags warns
@@ -240,13 +241,13 @@ instance ExceptionMonad m => GhcMonad (GhcT m) where
setSession s' = GhcT $ \(Session r) -> liftIO $ writeIORef r s'
--- | Print the error message and all warnings. Useful inside exception
--- handlers. Clears warnings after printing.
+-- | Print the all diagnostics in a 'SourceError'. Useful inside exception
+-- handlers.
printException :: GhcMonad m => SourceError -> m ()
printException err = do
dflags <- getSessionDynFlags
logger <- getLogger
- liftIO $ printBagOfErrors logger dflags (srcErrorMessages err)
+ liftIO $ printMessages logger dflags (srcErrorMessages err)
-- | A function called to log warnings and errors.
type WarnErrLogger = forall m. GhcMonad m => Maybe SourceError -> m ()
@@ -254,4 +255,3 @@ type WarnErrLogger = forall m. GhcMonad m => Maybe SourceError -> m ()
defaultWarnErrLogger :: WarnErrLogger
defaultWarnErrLogger Nothing = return ()
defaultWarnErrLogger (Just e) = printException e
-