% -----------------------------------------------------------------------------
-% $Id: PrelException.lhs,v 1.16 2000/04/10 13:35:45 simonmar Exp $
+% $Id: PrelException.lhs,v 1.21 2000/06/18 21:12:31 panne Exp $
%
% (c) The GRAP/AQUA Project, Glasgow University, 1998
%
| ArrayException ArrayException -- Array-related exceptions
| ErrorCall String -- Calls to 'error'
| NoMethodError String -- A non-existent method was invoked
- | PatternMatchFail String -- A pattern match failed
- | NonExhaustiveGuards String -- A guard match failed
+ | PatternMatchFail String -- A pattern match / guard failure
| RecSelError String -- Selecting a non-existent field
| RecConError String -- Field missing in record construction
| RecUpdError String -- Record doesn't contain updated field
data ArrayException
= IndexOutOfBounds String -- out-of-range array access
| UndefinedElement String -- evaluating an undefined element
+ deriving (Eq, Ord)
stackOverflow, heapOverflow :: Exception -- for the RTS
stackOverflow = AsyncException StackOverflow
showsPrec _ (ErrorCall err) = showString err
showsPrec _ (NoMethodError err) = showString err
showsPrec _ (PatternMatchFail err) = showString err
- showsPrec _ (NonExhaustiveGuards err) = showString err
showsPrec _ (RecSelError err) = showString err
showsPrec _ (RecConError err) = showString err
showsPrec _ (RecUpdError err) = showString err
-- the exception when applied to a world
\end{code}
+%*********************************************************
+%* *
+\subsection{Controlling asynchronous exception delivery}
+%* *
+%*********************************************************
+
+\begin{code}
+#ifndef __HUGS__
+blockAsyncExceptions :: IO a -> IO a
+blockAsyncExceptions (IO io) = IO $ blockAsyncExceptions# io
+
+unblockAsyncExceptions :: IO a -> IO a
+unblockAsyncExceptions (IO io) = IO $ unblockAsyncExceptions# io
+#else
+-- Not implemented yet in Hugs.
+blockAsyncExceptions :: IO a -> IO a
+blockAsyncExceptions (IO io) = IO io
+
+unblockAsyncExceptions :: IO a -> IO a
+unblockAsyncExceptions (IO io) = IO io
+#endif
+\end{code}
+