<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>System.IO.Error</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_System-IO-Error.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">base-4.5.1.0: Basic libraries</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>libraries@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">System.IO.Error</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">I/O errors </a><ul><li><a href="#g:2">Classifying I/O errors </a></li><li><a href="#g:3">Attributes of I/O errors </a></li></ul></li><li><a href="#g:4">Types of I/O error </a><ul><li><a href="#g:5"><code><a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></code> predicates </a></li></ul></li><li><a href="#g:6">Throwing and catching I/O errors </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Standard IO Errors. </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">type</span> <a href="#t:IOError">IOError</a> = <a href="Control-Exception-Base.html#t:IOException">IOException</a></li><li class="src short"><a href="#v:userError">userError</a> :: <a href="Data-String.html#t:String">String</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></li><li class="src short"><a href="#v:mkIOError">mkIOError</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-String.html#t:String">String</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="System-IO.html#t:FilePath">FilePath</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></li><li class="src short"><a href="#v:annotateIOError">annotateIOError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="System-IO.html#t:FilePath">FilePath</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></li><li class="src short"><a href="#v:isAlreadyExistsError">isAlreadyExistsError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isDoesNotExistError">isDoesNotExistError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isAlreadyInUseError">isAlreadyInUseError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isFullError">isFullError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isEOFError">isEOFError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isIllegalOperation">isIllegalOperation</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isPermissionError">isPermissionError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isUserError">isUserError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:ioeGetErrorType">ioeGetErrorType</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:ioeGetLocation">ioeGetLocation</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:ioeGetErrorString">ioeGetErrorString</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:ioeGetHandle">ioeGetHandle</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="GHC-IO-Handle.html#t:Handle">Handle</a></li><li class="src short"><a href="#v:ioeGetFileName">ioeGetFileName</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="System-IO.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:ioeSetErrorType">ioeSetErrorType</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></li><li class="src short"><a href="#v:ioeSetErrorString">ioeSetErrorString</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></li><li class="src short"><a href="#v:ioeSetLocation">ioeSetLocation</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></li><li class="src short"><a href="#v:ioeSetHandle">ioeSetHandle</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></li><li class="src short"><a href="#v:ioeSetFileName">ioeSetFileName</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO.html#t:FilePath">FilePath</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:IOErrorType">IOErrorType</a> </li><li class="src short"><a href="#v:alreadyExistsErrorType">alreadyExistsErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:doesNotExistErrorType">doesNotExistErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:alreadyInUseErrorType">alreadyInUseErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:fullErrorType">fullErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:eofErrorType">eofErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:illegalOperationErrorType">illegalOperationErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:permissionErrorType">permissionErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:userErrorType">userErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></li><li class="src short"><a href="#v:isAlreadyExistsErrorType">isAlreadyExistsErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isDoesNotExistErrorType">isDoesNotExistErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isAlreadyInUseErrorType">isAlreadyInUseErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isFullErrorType">isFullErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isEOFErrorType">isEOFErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isIllegalOperationErrorType">isIllegalOperationErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isPermissionErrorType">isPermissionErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:isUserErrorType">isUserErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:ioError">ioError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:catchIOError">catchIOError</a> :: <a href="System-IO.html#t:IO">IO</a> a -> (<a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO.html#t:IO">IO</a> a) -> <a href="System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:catch">catch</a> :: <a href="System-IO.html#t:IO">IO</a> a -> (<a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO.html#t:IO">IO</a> a) -> <a href="System-IO.html#t:IO">IO</a> a</li><li class="src short"><a href="#v:tryIOError">tryIOError</a> :: <a href="System-IO.html#t:IO">IO</a> a -> <a href="System-IO.html#t:IO">IO</a> (<a href="Data-Either.html#t:Either">Either</a> <a href="System-IO-Error.html#t:IOError">IOError</a> a)</li><li class="src short"><a href="#v:try">try</a> :: <a href="System-IO.html#t:IO">IO</a> a -> <a href="System-IO.html#t:IO">IO</a> (<a href="Data-Either.html#t:Either">Either</a> <a href="System-IO-Error.html#t:IOError">IOError</a> a)</li><li class="src short"><a href="#v:modifyIOError">modifyIOError</a> :: (<a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a>) -> <a href="System-IO.html#t:IO">IO</a> a -> <a href="System-IO.html#t:IO">IO</a> a</li></ul></div><div id="interface"><h1 id="g:1">I/O errors </h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:IOError" class="def">IOError</a> = <a href="Control-Exception-Base.html#t:IOException">IOException</a></p><div class="doc"><p>The Haskell 98 type for exceptions in the <code><a href="System-IO.html#t:IO">IO</a></code> monad. Any I/O operation may raise an <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> instead of returning a result. For a more general type of exception, including also those that arise in pure code, see <a href="Control-Exception-Exception.html">Control.Exception.Exception</a>. </p><p>In Haskell 98, this is an opaque type. </p></div></div><div class="top"><p class="src"><a name="v:userError" class="def">userError</a> :: <a href="Data-String.html#t:String">String</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></p><div class="doc"><p>Construct an <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> value with a string describing the error. The <code><a href="Control-Monad.html#v:fail">fail</a></code> method of the <code><a href="System-IO.html#t:IO">IO</a></code> instance of the <code><a href="Control-Monad.html#t:Monad">Monad</a></code> class raises a <code><a href="System-IO-Error.html#v:userError">userError</a></code>, thus: </p><pre> instance Monad IO where ... fail s = ioError (userError s) </pre></div></div><div class="top"><p class="src"><a name="v:mkIOError" class="def">mkIOError</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-String.html#t:String">String</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="System-IO.html#t:FilePath">FilePath</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></p><div class="doc"><p>Construct an <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> 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. </p></div></div><div class="top"><p class="src"><a name="v:annotateIOError" class="def">annotateIOError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="System-IO.html#t:FilePath">FilePath</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></p><div class="doc"><p>Adds a location description and maybe a file path and file handle to an <code><a href="System-IO-Error.html#t:IOError">IOError</a></code>. If any of the file handle or file path is not given the corresponding value in the <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> remains unaltered. </p></div></div><h2 id="g:2">Classifying I/O errors </h2><div class="top"><p class="src"><a name="v:isAlreadyExistsError" class="def">isAlreadyExistsError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>An error indicating that an <code><a href="System-IO.html#t:IO">IO</a></code> operation failed because one of its arguments already exists. </p></div></div><div class="top"><p class="src"><a name="v:isDoesNotExistError" class="def">isDoesNotExistError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>An error indicating that an <code><a href="System-IO.html#t:IO">IO</a></code> operation failed because one of its arguments does not exist. </p></div></div><div class="top"><p class="src"><a name="v:isAlreadyInUseError" class="def">isAlreadyInUseError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>An error indicating that an <code><a href="System-IO.html#t:IO">IO</a></code> 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). </p></div></div><div class="top"><p class="src"><a name="v:isFullError" class="def">isFullError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>An error indicating that an <code><a href="System-IO.html#t:IO">IO</a></code> operation failed because the device is full. </p></div></div><div class="top"><p class="src"><a name="v:isEOFError" class="def">isEOFError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>An error indicating that an <code><a href="System-IO.html#t:IO">IO</a></code> operation failed because the end of file has been reached. </p></div></div><div class="top"><p class="src"><a name="v:isIllegalOperation" class="def">isIllegalOperation</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>An error indicating that an <code><a href="System-IO.html#t:IO">IO</a></code> operation failed because the operation was not possible. Any computation which returns an <code><a href="System-IO.html#t:IO">IO</a></code> result may fail with <code><a href="System-IO-Error.html#v:isIllegalOperation">isIllegalOperation</a></code>. In some cases, an implementation will not be able to distinguish between the possible error causes. In this case it should fail with <code><a href="System-IO-Error.html#v:isIllegalOperation">isIllegalOperation</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:isPermissionError" class="def">isPermissionError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>An error indicating that an <code><a href="System-IO.html#t:IO">IO</a></code> operation failed because the user does not have sufficient operating system privilege to perform that operation. </p></div></div><div class="top"><p class="src"><a name="v:isUserError" class="def">isUserError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>A programmer-defined error value constructed using <code><a href="System-IO-Error.html#v:userError">userError</a></code>. </p></div></div><h2 id="g:3">Attributes of I/O errors </h2><div class="top"><p class="src"><a name="v:ioeGetErrorType" class="def">ioeGetErrorType</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p></div><div class="top"><p class="src"><a name="v:ioeGetLocation" class="def">ioeGetLocation</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a></p></div><div class="top"><p class="src"><a name="v:ioeGetErrorString" class="def">ioeGetErrorString</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a></p></div><div class="top"><p class="src"><a name="v:ioeGetHandle" class="def">ioeGetHandle</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="GHC-IO-Handle.html#t:Handle">Handle</a></p></div><div class="top"><p class="src"><a name="v:ioeGetFileName" class="def">ioeGetFileName</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-Maybe.html#t:Maybe">Maybe</a> <a href="System-IO.html#t:FilePath">FilePath</a></p></div><div class="top"><p class="src"><a name="v:ioeSetErrorType" class="def">ioeSetErrorType</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></p></div><div class="top"><p class="src"><a name="v:ioeSetErrorString" class="def">ioeSetErrorString</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></p></div><div class="top"><p class="src"><a name="v:ioeSetLocation" class="def">ioeSetLocation</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="Data-String.html#t:String">String</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></p></div><div class="top"><p class="src"><a name="v:ioeSetHandle" class="def">ioeSetHandle</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></p></div><div class="top"><p class="src"><a name="v:ioeSetFileName" class="def">ioeSetFileName</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO.html#t:FilePath">FilePath</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a></p></div><h1 id="g:4">Types of I/O error </h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:IOErrorType" class="def">IOErrorType</a> </p><div class="doc"><p>An abstract type that contains a value for each variant of <code><a href="System-IO-Error.html#t:IOError">IOError</a></code>. </p></div><div class="subs instances"><p id="control.i:IOErrorType" class="caption collapser" onclick="toggleSection('i:IOErrorType')">Instances</p><div id="section.i:IOErrorType" class="show"><table><tr><td class="src"><a href="Data-Eq.html#t:Eq">Eq</a> <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Text-Show.html#t:Show">Show</a> <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:alreadyExistsErrorType" class="def">alreadyExistsErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p><div class="doc"><p>I/O error where the operation failed because one of its arguments already exists. </p></div></div><div class="top"><p class="src"><a name="v:doesNotExistErrorType" class="def">doesNotExistErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p><div class="doc"><p>I/O error where the operation failed because one of its arguments does not exist. </p></div></div><div class="top"><p class="src"><a name="v:alreadyInUseErrorType" class="def">alreadyInUseErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p><div class="doc"><p>I/O error where the operation failed because one of its arguments is a single-use resource, which is already being used. </p></div></div><div class="top"><p class="src"><a name="v:fullErrorType" class="def">fullErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p><div class="doc"><p>I/O error where the operation failed because the device is full. </p></div></div><div class="top"><p class="src"><a name="v:eofErrorType" class="def">eofErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p><div class="doc"><p>I/O error where the operation failed because the end of file has been reached. </p></div></div><div class="top"><p class="src"><a name="v:illegalOperationErrorType" class="def">illegalOperationErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p><div class="doc"><p>I/O error where the operation is not possible. </p></div></div><div class="top"><p class="src"><a name="v:permissionErrorType" class="def">permissionErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p><div class="doc"><p>I/O error where the operation failed because the user does not have sufficient operating system privilege to perform that operation. </p></div></div><div class="top"><p class="src"><a name="v:userErrorType" class="def">userErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></p><div class="doc"><p>I/O error that is programmer-defined. </p></div></div><h2 id="g:5"><code><a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a></code> predicates </h2><div class="top"><p class="src"><a name="v:isAlreadyExistsErrorType" class="def">isAlreadyExistsErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>I/O error where the operation failed because one of its arguments already exists. </p></div></div><div class="top"><p class="src"><a name="v:isDoesNotExistErrorType" class="def">isDoesNotExistErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>I/O error where the operation failed because one of its arguments does not exist. </p></div></div><div class="top"><p class="src"><a name="v:isAlreadyInUseErrorType" class="def">isAlreadyInUseErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>I/O error where the operation failed because one of its arguments is a single-use resource, which is already being used. </p></div></div><div class="top"><p class="src"><a name="v:isFullErrorType" class="def">isFullErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>I/O error where the operation failed because the device is full. </p></div></div><div class="top"><p class="src"><a name="v:isEOFErrorType" class="def">isEOFErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>I/O error where the operation failed because the end of file has been reached. </p></div></div><div class="top"><p class="src"><a name="v:isIllegalOperationErrorType" class="def">isIllegalOperationErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>I/O error where the operation is not possible. </p></div></div><div class="top"><p class="src"><a name="v:isPermissionErrorType" class="def">isPermissionErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>I/O error where the operation failed because the user does not have sufficient operating system privilege to perform that operation. </p></div></div><div class="top"><p class="src"><a name="v:isUserErrorType" class="def">isUserErrorType</a> :: <a href="System-IO-Error.html#t:IOErrorType">IOErrorType</a> -> <a href="Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>I/O error that is programmer-defined. </p></div></div><h1 id="g:6">Throwing and catching I/O errors </h1><div class="top"><p class="src"><a name="v:ioError" class="def">ioError</a> :: <a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO.html#t:IO">IO</a> a</p><div class="doc"><p>Raise an <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> in the <code><a href="System-IO.html#t:IO">IO</a></code> monad. </p></div></div><div class="top"><p class="src"><a name="v:catchIOError" class="def">catchIOError</a> :: <a href="System-IO.html#t:IO">IO</a> a -> (<a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO.html#t:IO">IO</a> a) -> <a href="System-IO.html#t:IO">IO</a> a</p><div class="doc"><p>The <code><a href="System-IO-Error.html#v:catchIOError">catchIOError</a></code> function establishes a handler that receives any <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> raised in the action protected by <code><a href="System-IO-Error.html#v:catchIOError">catchIOError</a></code>. An <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> is caught by the most recent handler established by one of the exception handling functions. These handlers are not selective: all <code><a href="System-IO-Error.html#t:IOError">IOError</a></code>s are caught. Exception propagation must be explicitly provided in a handler by re-raising any unwanted exceptions. For example, in </p><pre> f = catchIOError g (\e -> if IO.isEOFError e then return [] else ioError e) </pre><p>the function <code>f</code> returns <code>[]</code> when an end-of-file exception (cf. <code><a href="System-IO-Error.html#v:isEOFError">isEOFError</a></code>) occurs in <code>g</code>; otherwise, the exception is propagated to the next outer handler. </p><p>When an exception propagates outside the main program, the Haskell system prints the associated <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> value and exits the program. </p><p>Non-I/O exceptions are not caught by this variant; to catch all exceptions, use <code><a href="Control-Exception.html#v:catch">catch</a></code> from <a href="Control-Exception.html">Control.Exception</a>. </p></div></div><div class="top"><p class="src"><a name="v:catch" class="def">catch</a> :: <a href="System-IO.html#t:IO">IO</a> a -> (<a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO.html#t:IO">IO</a> a) -> <a href="System-IO.html#t:IO">IO</a> a</p><div class="doc"><div class="warning"><p>Deprecated: Please use the new exceptions variant, Control.Exception.catch</p></div><p>The <code><a href="System-IO-Error.html#v:catch">catch</a></code> function is deprecated. Please use the new exceptions variant, <code><a href="Control-Exception.html#v:catch">catch</a></code> from <a href="Control-Exception.html">Control.Exception</a>, instead. </p></div></div><div class="top"><p class="src"><a name="v:tryIOError" class="def">tryIOError</a> :: <a href="System-IO.html#t:IO">IO</a> a -> <a href="System-IO.html#t:IO">IO</a> (<a href="Data-Either.html#t:Either">Either</a> <a href="System-IO-Error.html#t:IOError">IOError</a> a)</p><div class="doc"><p>The construct <code><a href="System-IO-Error.html#v:tryIOError">tryIOError</a></code> <code>comp</code> 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 <code><a href="Control-Exception.html#v:try">try</a></code> from <a href="Control-Exception.html">Control.Exception</a>. </p></div></div><div class="top"><p class="src"><a name="v:try" class="def">try</a> :: <a href="System-IO.html#t:IO">IO</a> a -> <a href="System-IO.html#t:IO">IO</a> (<a href="Data-Either.html#t:Either">Either</a> <a href="System-IO-Error.html#t:IOError">IOError</a> a)</p><div class="doc"><div class="warning"><p>Deprecated: Please use the new exceptions variant, Control.Exception.try</p></div><p>The <code><a href="System-IO-Error.html#v:try">try</a></code> function is deprecated. Please use the new exceptions variant, <code><a href="Control-Exception.html#v:try">try</a></code> from <a href="Control-Exception.html">Control.Exception</a>, instead. </p></div></div><div class="top"><p class="src"><a name="v:modifyIOError" class="def">modifyIOError</a> :: (<a href="System-IO-Error.html#t:IOError">IOError</a> -> <a href="System-IO-Error.html#t:IOError">IOError</a>) -> <a href="System-IO.html#t:IO">IO</a> a -> <a href="System-IO.html#t:IO">IO</a> a</p><div class="doc"><p>Catch any <code><a href="System-IO-Error.html#t:IOError">IOError</a></code> that occurs in the computation and throw a modified version. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>