Commit e49cbc07 authored by Simon Marlow's avatar Simon Marlow
Browse files

update from Haddock

parent 9bd9f197
......@@ -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}
......
......@@ -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}
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment