I/O errors

The Haskell 98 type for exceptions in the IO monad.
Any I/O operation may raise an IOError instead of returning a result.
For a more general type of exception, including also those that arise
in pure code, see Control.Exception.Exception.

Construct an IOError 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.

An error indicating that an IO 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).

An error indicating that an IO operation failed because
the operation was not possible.
Any computation which returns an IO result may fail with
isIllegalOperation. In some cases, an implementation will not be
able to distinguish between the possible error causes. In this case
it should fail with isIllegalOperation.

Throwing and catching I/O errors

The catchIOError function establishes a handler that receives any
IOError raised in the action protected by catchIOError.
An IOError is caught by
the most recent handler established by one of the exception handling
functions. These handlers are
not selective: all IOErrors are caught. Exception propagation
must be explicitly provided in a handler by re-raising any unwanted
exceptions. For example, in