summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-06-01 17:11:35 +0200
committerBen Gamari <ben@well-typed.com>2019-06-03 23:42:11 -0400
commitf984a86de8710fe31fb2f19f4ff9a86d12d777f1 (patch)
tree8a4f350dbeb2c478596fbba9f26735a5f815e06f
parent0cdd6459787ccef5990dfd31fc57dfb2f1593931 (diff)
downloadhaskell-f984a86de8710fe31fb2f19f4ff9a86d12d777f1.tar.gz
Move throwErrors to HscTypes
This, among other things, happened in 1ffee940a0 ("Fix warnings and fatal parsing errors") on master.
-rw-r--r--compiler/main/HscMain.hs4
-rw-r--r--compiler/main/HscTypes.hs6
2 files changed, 5 insertions, 5 deletions
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index 674afc9f47..1c83d93b24 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -233,10 +233,6 @@ logWarningsReportErrors (warns,errs) = do
logWarnings warns
when (not $ isEmptyBag errs) $ throwErrors errs
--- | Throw some errors.
-throwErrors :: ErrorMessages -> Hsc a
-throwErrors = liftIO . throwIO . mkSrcErr
-
-- | Deal with errors and warnings returned by a compilation step
--
-- In order to reduce dependencies to other parts of the compiler, functions
diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
index b29143a45b..d43f5c5815 100644
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -133,7 +133,7 @@ module HscTypes (
-- * Compilation errors and warnings
SourceError, GhcApiError, mkSrcErr, srcErrorMessages, mkApiErr,
- throwOneError, handleSourceError,
+ throwErrors, throwOneError, handleSourceError,
handleFlagWarnings, printOrThrowWarnings,
-- * COMPLETE signature
@@ -278,6 +278,10 @@ srcErrorMessages (SourceError msgs) = msgs
mkApiErr :: DynFlags -> SDoc -> GhcApiError
mkApiErr dflags msg = GhcApiError (showSDoc dflags msg)
+-- | Throw some errors.
+throwErrors :: MonadIO io => ErrorMessages -> io a
+throwErrors = liftIO . throwIO . mkSrcErr
+
throwOneError :: MonadIO m => ErrMsg -> m ab
throwOneError err = liftIO $ throwIO $ mkSrcErr $ unitBag err