A previous patch slightly changed the semantics of tryUser.
This patch restores the original behaviour
(as expected in :print)
#if __GLASGOW_HASKELL__ < 609
try_m :: TcRn r -> TcRn (Either Exception r)
#else
-try_m :: TcRn r -> TcRn (Either ErrorCall r)
+try_m :: TcRn r -> TcRn (Either IOException r)
#endif
-- Does try_m, with a debug-trace on failure
try_m thing
#if __GLASGOW_HASKELL__ < 609
tryM :: IOEnv env r -> IOEnv env (Either Exception r)
#else
-tryM :: IOEnv env r -> IOEnv env (Either ErrorCall r)
+tryM :: IOEnv env r -> IOEnv env (Either IOException r)
#endif
-- Reflect UserError exceptions (only) into IOEnv monad
-- Other exceptions are not caught; they are simply propagated as exns
tc_errors e@(Exception.IOException ioe) | isUserError ioe = Just e
tc_errors _other = Nothing
#else
-tryUser :: IO a -> IO (Either ErrorCall a)
+tryUser :: IO a -> IO (Either IOException a)
tryUser io =
do ei <- try io
case ei of
Right v -> return (Right v)
Left se@(SomeException ex) ->
- case cast ex of
- -- Look for good old fashioned ErrorCall's
- Just errorCall -> return (Left errorCall)
- Nothing ->
- case cast ex of
- -- And also for user errors in IO errors.
- -- Sigh.
+ case cast ex of
Just ioe
| isUserError ioe ->
- return (Left (ErrorCall (ioeGetErrorString ioe)))
+ return (Left ioe)
_ -> throw se
#endif
\end{code}