Commit e40299c3 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Use throwIO rather than throw

parent 45df0266
......@@ -52,6 +52,7 @@ import Data.IORef
import Data.Ord
import Data.Time
import Control.Monad
import Control.Monad.IO.Class
import System.IO
-- -----------------------------------------------------------------------------
......@@ -360,6 +361,6 @@ prettyPrintGhcErrors dflags
PprProgramError str doc ->
pprDebugAndThen dflags pgmError str doc
_ ->
throw e
liftIO $ throwIO e
\end{code}
......@@ -348,7 +348,7 @@ defaultErrorHandler fm (FlushOut flushOut) inner =
Just StackOverflow ->
fatalErrorMsg'' fm "stack overflow: use +RTS -K<size> to increase it"
_ -> case fromException exception of
Just (ex :: ExitCode) -> throw ex
Just (ex :: ExitCode) -> liftIO $ throwIO ex
_ ->
fatalErrorMsg'' fm
(show (Panic (show exception)))
......@@ -748,10 +748,10 @@ getModSummary mod = do
mg <- liftM hsc_mod_graph getSession
case [ ms | ms <- mg, ms_mod_name ms == mod, not (isBootSummary ms) ] of
[] -> do dflags <- getDynFlags
throw $ mkApiErr dflags (text "Module not part of module graph")
liftIO $ throwIO $ mkApiErr dflags (text "Module not part of module graph")
[ms] -> return ms
multiple -> do dflags <- getDynFlags
throw $ mkApiErr dflags (text "getModSummary is ambiguous: " <+> ppr multiple)
liftIO $ throwIO $ mkApiErr dflags (text "getModSummary is ambiguous: " <+> ppr multiple)
-- | Parse a module.
--
......@@ -1213,7 +1213,7 @@ getModuleSourceAndFlags mod = do
m <- getModSummary (moduleName mod)
case ml_hs_file $ ms_location m of
Nothing -> do dflags <- getDynFlags
throw $ mkApiErr dflags (text "No source available for module " <+> ppr mod)
liftIO $ throwIO $ mkApiErr dflags (text "No source available for module " <+> ppr mod)
Just sourceFile -> do
source <- liftIO $ hGetStringBuffer sourceFile
return (sourceFile, source, ms_hspp_opts m)
......@@ -1231,7 +1231,7 @@ getTokenStream mod = do
POk _ ts -> return ts
PFailed span err ->
do dflags <- getDynFlags
throw $ mkSrcErr (unitBag $ mkPlainErrMsg dflags span err)
liftIO $ throwIO $ mkSrcErr (unitBag $ mkPlainErrMsg dflags span err)
-- | Give even more information on the source than 'getTokenStream'
-- This function allows reconstructing the source completely with
......@@ -1244,7 +1244,7 @@ getRichTokenStream mod = do
POk _ ts -> return $ addSourceToTokens startLoc source ts
PFailed span err ->
do dflags <- getDynFlags
throw $ mkSrcErr (unitBag $ mkPlainErrMsg dflags span err)
liftIO $ throwIO $ mkSrcErr (unitBag $ mkPlainErrMsg dflags span err)
-- | Given a source location and a StringBuffer corresponding to this
-- location, return a rich token stream with the source associated to the
......
......@@ -540,7 +540,7 @@ runClang dflags args = do
text ("Error running clang! you need clang installed to use the" ++
"LLVM backend") $+$
text "(or GHC tried to execute clang incorrectly)"
throw err
throwIO err
)
-- | Figure out which version of LLVM we are running this session
......
......@@ -93,5 +93,5 @@ ghandle = flip gcatch
gonException :: (ExceptionMonad m) => m a -> m b -> m a
gonException ioA cleanup = ioA `gcatch` \e ->
do _ <- cleanup
throw (e :: SomeException)
liftIO $ throwIO (e :: SomeException)
......@@ -833,7 +833,7 @@ runStmt stmt step
-- | Clean up the GHCi environment after a statement has run
afterRunStmt :: (SrcSpan -> Bool) -> GHC.RunResult -> GHCi Bool
afterRunStmt _ (GHC.RunException e) = throw e
afterRunStmt _ (GHC.RunException e) = liftIO $ Exception.throwIO e
afterRunStmt step_here run_result = do
resumes <- GHC.getResumeContext
case run_result of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment