X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FPanic.lhs;h=0e049b0cfbf1b7fc8a6d38fa3ab7aa7d1e58d0ea;hb=ec197dfef33654dd16b5832905dad2e52f79f7ab;hp=f2e63129b48425392bbd826c087068b93d7d3427;hpb=81466110ff8104ca60e20d617bab83f6f78f0ec2;p=ghc-hetmet.git diff --git a/compiler/utils/Panic.lhs b/compiler/utils/Panic.lhs index f2e6312..0e049b0 100644 --- a/compiler/utils/Panic.lhs +++ b/compiler/utils/Panic.lhs @@ -136,11 +136,11 @@ throwGhcException = Exception.throwDyn throwGhcException = Exception.throw #endif -handleGhcException :: (GhcException -> IO a) -> IO a -> IO a +handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a #if __GLASGOW_HASKELL__ < 609 -handleGhcException = flip Exception.catchDyn +handleGhcException = flip gcatchDyn #else -handleGhcException = Exception.handle +handleGhcException = ghandle #endif ghcExceptionTc :: TyCon @@ -219,22 +219,16 @@ tryUser action = tryJust tc_errors action 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}