update from Haddock
authorSimon Marlow <marlowsd@gmail.com>
Fri, 2 Jul 2010 13:54:43 +0000 (13:54 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Fri, 2 Jul 2010 13:54:43 +0000 (13:54 +0000)
report/libs/Data-Char.tex
report/libs/Data-Int.tex
report/libs/System-IO-Error.tex

index b0d67eb..8c01abb 100644 (file)
@@ -64,7 +64,7 @@ by Unicode, use \haddocktt{Prelude.toEnum} and \haddocktt{Prelude.fromEnum} from
 \end{haddockdesc}
 \begin{haddockdesc}
 \item[\begin{tabular}{@{}l}
-instance\ Eq\ Char\\instance\ Ord\ Char\\instance\ Read\ Char\\instance\ Show\ Char\\instance\ Ix\ Char\\instance\ Storable\ Char
+instance\ Bounded\ Char\\instance\ Enum\ Char\\instance\ Eq\ Char\\instance\ Ord\ Char\\instance\ Read\ Char\\instance\ Show\ Char\\instance\ Ix\ Char\\instance\ Storable\ Char
 \end{tabular}]
 \end{haddockdesc}
 \begin{haddockdesc}
index 6d46d6b..e59cb6b 100644 (file)
@@ -43,7 +43,7 @@ A fixed-precision integer type with at least the range \haddocktt{{\char 91}-2{\
 \end{haddockdesc}
 \begin{haddockdesc}
 \item[\begin{tabular}{@{}l}
-instance\ Eq\ Int\\instance\ Integral\ Int\\instance\ Num\ Int\\instance\ Ord\ Int\\instance\ Read\ Int\\instance\ Real\ Int\\instance\ Show\ Int\\instance\ Ix\ Int\\instance\ Storable\ Int\\instance\ Bits\ Int
+instance\ Bounded\ Int\\instance\ Enum\ Int\\instance\ Eq\ Int\\instance\ Integral\ Int\\instance\ Num\ Int\\instance\ Ord\ Int\\instance\ Read\ Int\\instance\ Real\ Int\\instance\ Show\ Int\\instance\ Ix\ Int\\instance\ Storable\ Int\\instance\ Bits\ Int
 \end{tabular}]
 \end{haddockdesc}
 \begin{haddockdesc}
index 3c7d0c1..4bce3d9 100644 (file)
@@ -9,7 +9,7 @@ module System.IO.Error (
     ioeGetHandle,  ioeGetFileName,  IOErrorType,  alreadyExistsErrorType, 
     doesNotExistErrorType,  alreadyInUseErrorType,  fullErrorType, 
     eofErrorType,  illegalOperationErrorType,  permissionErrorType, 
-    userErrorType
+    userErrorType,  ioError,  catch,  try
   ) where\end{verbatim}}
 \haddockendheader
 
@@ -239,4 +239,48 @@ userErrorType\ ::\ IOErrorType
 I/O error that is programmer-defined.
 \par
 
+\end{haddockdesc}
+\section{Throwing and catching I/O errors
+}
+\begin{haddockdesc}
+\item[\begin{tabular}{@{}l}
+ioError\ ::\ IOError\ ->\ IO\ a
+\end{tabular}]\haddockbegindoc
+Raise an \haddockid{IOError} in the \haddockid{IO} monad.
+\par
+
+\end{haddockdesc}
+\begin{haddockdesc}
+\item[\begin{tabular}{@{}l}
+catch\ ::\ IO\ a\ ->\ (IOError\ ->\ IO\ a)\ ->\ IO\ a
+\end{tabular}]\haddockbegindoc
+The \haddockid{catch} function establishes a handler that receives any \haddockid{IOError}
+ raised in the action protected by \haddockid{catch}.  An \haddockid{IOError} is caught by
+ the most recent handler established by \haddockid{catch}.  These handlers are
+ not selective: all \haddockid{IOError}s are caught.  Exception propagation
+ must be explicitly provided in a handler by re-raising any unwanted
+ exceptions.  For example, in
+\par
+\begin{quote}
+{\haddockverb\begin{verbatim}
+ f = catch g (\e -> if IO.isEOFError e then return [] else ioError e)
+\end{verbatim}}
+\end{quote}
+the function \haddocktt{f} returns \haddocktt{{\char 91}{\char 93}} when an end-of-file exception
+ (cf. \haddockid{isEOFError}) occurs in \haddocktt{g}; otherwise, the
+ exception is propagated to the next outer handler.
+\par
+When an exception propagates outside the main program, the Haskell
+ system prints the associated \haddockid{IOError} value and exits the program.
+\par
+
+\end{haddockdesc}
+\begin{haddockdesc}
+\item[\begin{tabular}{@{}l}
+try\ ::\ IO\ a\ ->\ IO\ (Either\ IOError\ a)
+\end{tabular}]\haddockbegindoc
+The construct \haddockid{try} \haddocktt{comp} exposes IO errors which occur within a
+ computation, and which are not fully handled.
+\par
+
 \end{haddockdesc}
\ No newline at end of file