<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--Rendered using the Haskell Html Library v0.2--> <HTML ><HEAD ><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" ><TITLE >System.IO.Error</TITLE ><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" ><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" ></SCRIPT ><SCRIPT TYPE="text/javascript" >window.onload = function () {setSynopsis("mini_System-IO-Error.html")};</SCRIPT ></HEAD ><BODY ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="topbar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " ></TD ><TD CLASS="title" >base-4.1.0.0: Basic libraries</TD ><TD CLASS="topbut" ><A HREF="index.html" >Contents</A ></TD ><TD CLASS="topbut" ><A HREF="doc-index.html" >Index</A ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="modulebar" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD ><FONT SIZE="6" >System.IO.Error</FONT ></TD ><TD ALIGN="right" ><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="infohead" >Portability</TD ><TD CLASS="infoval" >portable</TD ></TR ><TR ><TD CLASS="infohead" >Stability</TD ><TD CLASS="infoval" >provisional</TD ></TR ><TR ><TD CLASS="infohead" >Maintainer</TD ><TD CLASS="infoval" >libraries@haskell.org</TD ></TR ></TABLE ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="section4" ><B >Contents</B ></TD ></TR ><TR ><TD ><DL ><DT ><A HREF="#1" >I/O errors </A ></DT ><DD ><DL ><DT ><A HREF="#2" >Classifying I/O errors </A ></DT ><DT ><A HREF="#3" >Attributes of I/O errors </A ></DT ></DL ></DD ><DT ><A HREF="#4" >Types of I/O error </A ></DT ><DD ><DL ><DT ><A HREF="#5" ><TT ><A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TT > predicates </A ></DT ></DL ></DD ><DT ><A HREF="#6" >Throwing and catching I/O errors </A ></DT ></DL ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Description</TD ></TR ><TR ><TD CLASS="doc" >Standard IO Errors. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" >Synopsis</TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A HREF="#t%3AIOError" >IOError</A > = <A HREF="Control-Exception-Base.html#t%3AIOException" >IOException</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AuserError" >userError</A > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmkIOError" >mkIOError</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AHandle" >Handle</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AFilePath" >FilePath</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AannotateIOError" >annotateIOError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AHandle" >Handle</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AFilePath" >FilePath</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisAlreadyExistsError" >isAlreadyExistsError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisDoesNotExistError" >isDoesNotExistError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisAlreadyInUseError" >isAlreadyInUseError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisFullError" >isFullError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisEOFError" >isEOFError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisIllegalOperation" >isIllegalOperation</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisPermissionError" >isPermissionError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisUserError" >isUserError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeGetErrorType" >ioeGetErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeGetLocation" >ioeGetLocation</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeGetErrorString" >ioeGetErrorString</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeGetHandle" >ioeGetHandle</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AHandle" >Handle</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeGetFileName" >ioeGetFileName</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AFilePath" >FilePath</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeSetErrorType" >ioeSetErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeSetErrorString" >ioeSetErrorString</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeSetLocation" >ioeSetLocation</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeSetHandle" >ioeSetHandle</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO.html#t%3AHandle" >Handle</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioeSetFileName" >ioeSetFileName</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO.html#t%3AFilePath" >FilePath</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A HREF="#t%3AIOErrorType" >IOErrorType</A > </TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AalreadyExistsErrorType" >alreadyExistsErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AdoesNotExistErrorType" >doesNotExistErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AalreadyInUseErrorType" >alreadyInUseErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AfullErrorType" >fullErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AeofErrorType" >eofErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AillegalOperationErrorType" >illegalOperationErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3ApermissionErrorType" >permissionErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AuserErrorType" >userErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisAlreadyExistsErrorType" >isAlreadyExistsErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisDoesNotExistErrorType" >isDoesNotExistErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisAlreadyInUseErrorType" >isAlreadyInUseErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisFullErrorType" >isFullErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisEOFErrorType" >isEOFErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisIllegalOperationErrorType" >isIllegalOperationErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisPermissionErrorType" >isPermissionErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AisUserErrorType" >isUserErrorType</A > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AioError" >ioError</A > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > a</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Prelude.html#v%3Acatch" >catch</A ></TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3Atry" >try</A > :: <A HREF="System-IO.html#t%3AIO" >IO</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Data-Either.html#t%3AEither" >Either</A > <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > a)</TD ></TR ><TR ><TD CLASS="s8" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="#v%3AmodifyIOError" >modifyIOError</A > :: (<A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A >) -> <A HREF="System-IO.html#t%3AIO" >IO</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > a</TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="1" ><A NAME="1" >I/O errors </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >type</SPAN > <A NAME="t:IOError" ><A NAME="t%3AIOError" ></A ></A ><B >IOError</B > = <A HREF="Control-Exception-Base.html#t%3AIOException" >IOException</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >The Haskell 98 type for exceptions in the <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > monad. Any I/O operation may raise an <TT ><A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TT > instead of returning a result. For a more general type of exception, including also those that arise in pure code, see Control.Exception.Exception. </P ><P >In Haskell 98, this is an opaque type. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:userError" ><A NAME="v%3AuserError" ></A ></A ><B >userError</B > :: <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="doc" ><P >Construct an <TT ><A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TT > value with a string describing the error. The <TT ><A HREF="Control-Monad.html#v%3Afail" >fail</A ></TT > method of the <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > instance of the <TT ><A HREF="Control-Monad.html#t%3AMonad" >Monad</A ></TT > class raises a <TT ><A HREF="System-IO-Error.html#v%3AuserError" >userError</A ></TT >, thus: </P ><PRE > instance Monad IO where ... fail s = ioError (userError s) </PRE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:mkIOError" ><A NAME="v%3AmkIOError" ></A ></A ><B >mkIOError</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AHandle" >Handle</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AFilePath" >FilePath</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="doc" >Construct an <TT ><A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TT > of the given type where the second argument describes the error location and the third and fourth argument contain the file handle and file path of the file involved in the error if applicable. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:annotateIOError" ><A NAME="v%3AannotateIOError" ></A ></A ><B >annotateIOError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AHandle" >Handle</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AFilePath" >FilePath</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="doc" >Adds a location description and maybe a file path and file handle to an <TT ><A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TT >. If any of the file handle or file path is not given the corresponding value in the <TT ><A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TT > remains unaltered. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="2" ><A NAME="2" >Classifying I/O errors </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isAlreadyExistsError" ><A NAME="v%3AisAlreadyExistsError" ></A ></A ><B >isAlreadyExistsError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >An error indicating that an <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > operation failed because one of its arguments already exists. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isDoesNotExistError" ><A NAME="v%3AisDoesNotExistError" ></A ></A ><B >isDoesNotExistError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >An error indicating that an <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > operation failed because one of its arguments does not exist. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isAlreadyInUseError" ><A NAME="v%3AisAlreadyInUseError" ></A ></A ><B >isAlreadyInUseError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >An error indicating that an <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > operation failed because one of its arguments is a single-use resource, which is already being used (for example, opening the same file twice for writing might give this error). </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isFullError" ><A NAME="v%3AisFullError" ></A ></A ><B >isFullError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >An error indicating that an <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > operation failed because the device is full. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isEOFError" ><A NAME="v%3AisEOFError" ></A ></A ><B >isEOFError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >An error indicating that an <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > operation failed because the end of file has been reached. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isIllegalOperation" ><A NAME="v%3AisIllegalOperation" ></A ></A ><B >isIllegalOperation</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >An error indicating that an <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > operation failed because the operation was not possible. Any computation which returns an <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > result may fail with <TT ><A HREF="System-IO-Error.html#v%3AisIllegalOperation" >isIllegalOperation</A ></TT >. In some cases, an implementation will not be able to distinguish between the possible error causes. In this case it should fail with <TT ><A HREF="System-IO-Error.html#v%3AisIllegalOperation" >isIllegalOperation</A ></TT >. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isPermissionError" ><A NAME="v%3AisPermissionError" ></A ></A ><B >isPermissionError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >An error indicating that an <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > operation failed because the user does not have sufficient operating system privilege to perform that operation. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isUserError" ><A NAME="v%3AisUserError" ></A ></A ><B >isUserError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >A programmer-defined error value constructed using <TT ><A HREF="System-IO-Error.html#v%3AuserError" >userError</A ></TT >. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="3" ><A NAME="3" >Attributes of I/O errors </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeGetErrorType" ><A NAME="v%3AioeGetErrorType" ></A ></A ><B >ioeGetErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeGetLocation" ><A NAME="v%3AioeGetLocation" ></A ></A ><B >ioeGetLocation</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeGetErrorString" ><A NAME="v%3AioeGetErrorString" ></A ></A ><B >ioeGetErrorString</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeGetHandle" ><A NAME="v%3AioeGetHandle" ></A ></A ><B >ioeGetHandle</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AHandle" >Handle</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeGetFileName" ><A NAME="v%3AioeGetFileName" ></A ></A ><B >ioeGetFileName</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Maybe.html#t%3AMaybe" >Maybe</A > <A HREF="System-IO.html#t%3AFilePath" >FilePath</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeSetErrorType" ><A NAME="v%3AioeSetErrorType" ></A ></A ><B >ioeSetErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeSetErrorString" ><A NAME="v%3AioeSetErrorString" ></A ></A ><B >ioeSetErrorString</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeSetLocation" ><A NAME="v%3AioeSetLocation" ></A ></A ><B >ioeSetLocation</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="Data-Char.html#t%3AString" >String</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeSetHandle" ><A NAME="v%3AioeSetHandle" ></A ></A ><B >ioeSetHandle</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO.html#t%3AHandle" >Handle</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioeSetFileName" ><A NAME="v%3AioeSetFileName" ></A ></A ><B >ioeSetFileName</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO.html#t%3AFilePath" >FilePath</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="4" ><A NAME="4" >Types of I/O error </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><SPAN CLASS="keyword" >data</SPAN > <A NAME="t:IOErrorType" ><A NAME="t%3AIOErrorType" ></A ></A ><B >IOErrorType</B > </TD ></TR ><TR ><TD CLASS="body" ><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" ><TR ><TD CLASS="ndoc" >An abstract type that contains a value for each variant of <TT ><A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TT >. </TD ></TR ><TR ><TD CLASS="section4" ><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:IOErrorType')" ALT="show/hide" > Instances</TD ></TR ><TR ><TD CLASS="body" ><DIV ID="i:IOErrorType" STYLE="display:block;" ><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" ><TR ><TD CLASS="decl" ><A HREF="Data-Eq.html#t%3AEq" >Eq</A > <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Text-Show.html#t%3AShow" >Show</A > <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:alreadyExistsErrorType" ><A NAME="v%3AalreadyExistsErrorType" ></A ></A ><B >alreadyExistsErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because one of its arguments already exists. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:doesNotExistErrorType" ><A NAME="v%3AdoesNotExistErrorType" ></A ></A ><B >doesNotExistErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because one of its arguments does not exist. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:alreadyInUseErrorType" ><A NAME="v%3AalreadyInUseErrorType" ></A ></A ><B >alreadyInUseErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because one of its arguments is a single-use resource, which is already being used. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:fullErrorType" ><A NAME="v%3AfullErrorType" ></A ></A ><B >fullErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because the device is full. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:eofErrorType" ><A NAME="v%3AeofErrorType" ></A ></A ><B >eofErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because the end of file has been reached. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:illegalOperationErrorType" ><A NAME="v%3AillegalOperationErrorType" ></A ></A ><B >illegalOperationErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation is not possible. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:permissionErrorType" ><A NAME="v%3ApermissionErrorType" ></A ></A ><B >permissionErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because the user does not have sufficient operating system privilege to perform that operation. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:userErrorType" ><A NAME="v%3AuserErrorType" ></A ></A ><B >userErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error that is programmer-defined. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section2" ><A NAME="5" ><A NAME="5" ><TT ><A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A ></TT > predicates </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isAlreadyExistsErrorType" ><A NAME="v%3AisAlreadyExistsErrorType" ></A ></A ><B >isAlreadyExistsErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because one of its arguments already exists. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isDoesNotExistErrorType" ><A NAME="v%3AisDoesNotExistErrorType" ></A ></A ><B >isDoesNotExistErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because one of its arguments does not exist. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isAlreadyInUseErrorType" ><A NAME="v%3AisAlreadyInUseErrorType" ></A ></A ><B >isAlreadyInUseErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because one of its arguments is a single-use resource, which is already being used. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isFullErrorType" ><A NAME="v%3AisFullErrorType" ></A ></A ><B >isFullErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because the device is full. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isEOFErrorType" ><A NAME="v%3AisEOFErrorType" ></A ></A ><B >isEOFErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because the end of file has been reached. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isIllegalOperationErrorType" ><A NAME="v%3AisIllegalOperationErrorType" ></A ></A ><B >isIllegalOperationErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation is not possible. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isPermissionErrorType" ><A NAME="v%3AisPermissionErrorType" ></A ></A ><B >isPermissionErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error where the operation failed because the user does not have sufficient operating system privilege to perform that operation. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:isUserErrorType" ><A NAME="v%3AisUserErrorType" ></A ></A ><B >isUserErrorType</B > :: <A HREF="System-IO-Error.html#t%3AIOErrorType" >IOErrorType</A > -> <A HREF="../ghc-prim/GHC-Bool.html#t%3ABool" >Bool</A ></TD ></TR ><TR ><TD CLASS="doc" >I/O error that is programmer-defined. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="section1" ><A NAME="6" ><A NAME="6" >Throwing and catching I/O errors </A ></A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:ioError" ><A NAME="v%3AioError" ></A ></A ><B >ioError</B > :: <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO.html#t%3AIO" >IO</A > a</TD ></TR ><TR ><TD CLASS="doc" >Raise an <TT ><A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TT > in the <TT ><A HREF="System-IO.html#t%3AIO" >IO</A ></TT > monad. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A HREF="Prelude.html#v%3Acatch" >catch</A ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:try" ><A NAME="v%3Atry" ></A ></A ><B >try</B > :: <A HREF="System-IO.html#t%3AIO" >IO</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > (<A HREF="Data-Either.html#t%3AEither" >Either</A > <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > a)</TD ></TR ><TR ><TD CLASS="doc" ><P >The construct <TT ><A HREF="System-IO-Error.html#v%3Atry" >try</A ></TT > <TT >comp</TT > exposes IO errors which occur within a computation, and which are not fully handled. </P ><P >Non-I/O exceptions are not caught by this variant; to catch all exceptions, use Control.Exception.try from <A HREF="Control-Exception.html" >Control.Exception</A >. </P ></TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="decl" ><A NAME="v:modifyIOError" ><A NAME="v%3AmodifyIOError" ></A ></A ><B >modifyIOError</B > :: (<A HREF="System-IO-Error.html#t%3AIOError" >IOError</A > -> <A HREF="System-IO-Error.html#t%3AIOError" >IOError</A >) -> <A HREF="System-IO.html#t%3AIO" >IO</A > a -> <A HREF="System-IO.html#t%3AIO" >IO</A > a</TD ></TR ><TR ><TD CLASS="doc" >Catch any <TT ><A HREF="System-IO-Error.html#t%3AIOError" >IOError</A ></TT > that occurs in the computation and throw a modified version. </TD ></TR ><TR ><TD CLASS="s15" ></TD ></TR ><TR ><TD CLASS="botbar" >Produced by <A HREF="http://www.haskell.org/haddock/" >Haddock</A > version 2.4.2</TD ></TR ></TABLE ></BODY ></HTML >