[Prev] [Up] [Next]


I/O Errors "PreludeIOError"

Haskell 1.2 does not provide standard error values for I/O errors. This is unacceptable for portable implementations which indulge in non-trivial I/O. The IOError type has therefore been extended from Haskell 1.2, and possible error values have been identified for all standard operations. (Rationale)


> interface PreludeIOError where

> data IOError = AlreadyExists String
>              | HardwareFault String
>              | IllegalOperation String
>              | InappropriateType String
>              | Interrupted String
>              | InvalidArgument String
>              | NoSuchThing String
>              | OtherError String
>              | PermissionDenied String
>              | ProtocolError String
>              | ResourceBusy String
>              | ResourceExhausted String
>              | ResourceVanished String
>              | SystemError String
>              | TimeExpired String
>              | UnsatisfiedConstraints String
>              | UnsupportedOperation String
>              | UserError String
>              | EOF

> instance Text IOError where
>    showsPrec _ e s = ...

SystemError is reserved for the low-level operating system interface routines, such as those defined in LibPOSIX, and should not be returned by the high-level routines in the Prelude.

The String part of an IOError is platform-dependent. However, to provide a uniform mechanism for distinguishing among errors within these broad categories, each platform-specific standard shall specify the exact strings to be used for particular errors. For errors not explicitly mentioned in the standard, any descriptive string may be used.


[Prev] [Up] [Next]


The Definition of Monadic I/O in Haskell 1.3
Haskell 1.3 Committee
haskell1.3@comp.vuw.ac.nz