% -----------------------------------------------------------------------------
-% $Id: Exception.lhs,v 1.3 1999/01/07 16:39:07 simonm Exp $
+% $Id: Exception.lhs,v 1.4 1999/01/14 18:15:29 sof Exp $
%
% (c) The GRAP/AQUA Project, Glasgow University, 1998
%
#endif
tryAllIO :: IO a -> IO (Either Exception a)
-tryAllIO a = catchAllIO (a >>= \a -> return (Right a))
+tryAllIO a = catchAllIO (a >>= \ v -> return (Right v))
(\e -> return (Left e))
try :: (Exception -> Maybe b) -> a -> IO (Either b a)
try p a = do
r <- tryAll a
case r of
- Right a -> return (Right a)
+ Right v -> return (Right v)
Left e -> case p e of
Nothing -> throw e
Just b -> return (Left b)
tryIO p a = do
r <- tryAllIO a
case r of
- Right a -> return (Right a)
+ Right v -> return (Right v)
Left e -> case p e of
Nothing -> throw e
Just b -> return (Left b)
case fromDynamic dyn of
Just exception -> k exception
Nothing -> throw ex
- other -> throw ex
+ _ -> throw ex
\end{code}
-----------------------------------------------------------------------------