summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Utils/Monad.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-06-02 15:30:07 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-01 03:30:36 -0400
commitb51b4b9777d49bef5f0a1f6dcbf12ddbcfd9ef59 (patch)
tree453488a4a227bb615d321435f3849b63f25ad428 /compiler/GHC/Tc/Utils/Monad.hs
parentf79615d2df9327cde8aae66c6ec211031b69b83c (diff)
downloadhaskell-b51b4b9777d49bef5f0a1f6dcbf12ddbcfd9ef59.tar.gz
Make withException use SDocContext instead of DynFlags
Diffstat (limited to 'compiler/GHC/Tc/Utils/Monad.hs')
-rw-r--r--compiler/GHC/Tc/Utils/Monad.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs
index dea37f4919..0572ab00db 100644
--- a/compiler/GHC/Tc/Utils/Monad.hs
+++ b/compiler/GHC/Tc/Utils/Monad.hs
@@ -174,7 +174,6 @@ import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
import GHC.Driver.Env
-import GHC.Driver.Ppr
import GHC.Driver.Session
import GHC.Runtime.Context
@@ -600,11 +599,11 @@ getEpsAndHpt = do { env <- getTopEnv; eps <- liftIO $ hscEPS env
-- | A convenient wrapper for taking a @MaybeErr SDoc a@ and throwing
-- an exception if it is an error.
-withException :: MonadIO m => DynFlags -> m (MaybeErr SDoc a) -> m a
-withException dflags do_this = do
+withException :: MonadIO m => SDocContext -> m (MaybeErr SDoc a) -> m a
+withException ctx do_this = do
r <- do_this
case r of
- Failed err -> liftIO $ throwGhcExceptionIO (ProgramError (showSDoc dflags err))
+ Failed err -> liftIO $ throwGhcExceptionIO (ProgramError (renderWithContext ctx err))
Succeeded result -> return result
{-