import FastString
import Panic
import Util
-import Exception
import System.IO
import Data.IORef
:: HscEnv
-> Module
-> TcM r
- -> IO (Maybe r)
+ -> IO (Messages, Maybe r)
initTcPrintErrors env mod todo = do
(msgs, res) <- initTc env HsSrcFile False mod todo
- printErrorsAndWarnings (hsc_dflags env) msgs
- return res
+ return (msgs, res)
\end{code}
%************************************************************************
\begin{code}
-#if __GLASGOW_HASKELL__ < 609
-try_m :: TcRn r -> TcRn (Either Exception r)
-#else
-try_m :: TcRn r -> TcRn (Either ErrorCall r)
-#endif
+try_m :: TcRn r -> TcRn (Either IOEnvFailure r)
-- Does try_m, with a debug-trace on failure
try_m thing
= do { mb_r <- tryM thing ;
-- Drop elements of the input that fail, so the result
-- list can be shorter than the argument list
mapAndRecoverM _ [] = return []
-mapAndRecoverM f (x:xs) = do { mb_r <- tryM (f x)
+mapAndRecoverM f (x:xs) = do { mb_r <- try_m (f x)
; rs <- mapAndRecoverM f xs
; return (case mb_r of
Left _ -> rs