Haskell Core Libraries (base package)ParentContentsIndex
GHC.IOBase
Portability non-portable (GHC Extensions)
Stability internal
Maintainer cvs-ghc@haskell.org
Description
Definitions for the IO monad and its friends.
Synopsis
data ArithException
= Overflow
| Underflow
| LossOfPrecision
| DivideByZero
| Denormal
data ArrayException
= IndexOutOfBounds String
| UndefinedElement String
data AsyncException
= StackOverflow
| HeapOverflow
| ThreadKilled
data Buffer = Buffer {
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
}
data BufferList
= BufferListNil
| BufferListCons RawBuffer BufferList
data BufferMode
= NoBuffering
| LineBuffering
| BlockBuffering (Maybe Int)
data BufferState
= ReadBuffer
| WriteBuffer
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data ExitCode
= ExitSuccess
| ExitFailure Int
type FD = Int
type FilePath = String
data Handle
= FileHandle !(MVar Handle__)
| DuplexHandle !(MVar Handle__) !(MVar Handle__)
data HandleType
= ClosedHandle
| SemiClosedHandle
| ReadHandle
| WriteHandle
| AppendHandle
| ReadWriteHandle
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
newtype IO a = IO (State# RealWorld -> (#State# RealWorld, a#))
type IOError = Exception
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOException = IOError {
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
}
newtype IORef a = IORef (STRef RealWorld a)
data MVar a = MVar (MVar# RealWorld a)
type RawBuffer = MutableByteArray# RealWorld
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data HandleType
= ClosedHandle
| SemiClosedHandle
| ReadHandle
| WriteHandle
| AppendHandle
| ReadWriteHandle
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data BufferMode
= NoBuffering
| LineBuffering
| BlockBuffering (Maybe Int)
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data Buffer = Buffer {
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
}
data BufferList
= BufferListNil
| BufferListCons RawBuffer BufferList
data BufferList
= BufferListNil
| BufferListCons RawBuffer BufferList
data HandleType
= ClosedHandle
| SemiClosedHandle
| ReadHandle
| WriteHandle
| AppendHandle
| ReadWriteHandle
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data ArithException
= Overflow
| Underflow
| LossOfPrecision
| DivideByZero
| Denormal
data ArithException
= Overflow
| Underflow
| LossOfPrecision
| DivideByZero
| Denormal
data Handle
= FileHandle !(MVar Handle__)
| DuplexHandle !(MVar Handle__) !(MVar Handle__)
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data ExitCode
= ExitSuccess
| ExitFailure Int
data ExitCode
= ExitSuccess
| ExitFailure Int
data Handle
= FileHandle !(MVar Handle__)
| DuplexHandle !(MVar Handle__) !(MVar Handle__)
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data AsyncException
= StackOverflow
| HeapOverflow
| ThreadKilled
newtype IO a = IO (State# RealWorld -> (#State# RealWorld, a#))
data IOException = IOError {
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
}
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
newtype IORef a = IORef (STRef RealWorld a)
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data ArrayException
= IndexOutOfBounds String
| UndefinedElement String
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data BufferMode
= NoBuffering
| LineBuffering
| BlockBuffering (Maybe Int)
data ArithException
= Overflow
| Underflow
| LossOfPrecision
| DivideByZero
| Denormal
data MVar a = MVar (MVar# RealWorld a)
data BufferMode
= NoBuffering
| LineBuffering
| BlockBuffering (Maybe Int)
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data ArithException
= Overflow
| Underflow
| LossOfPrecision
| DivideByZero
| Denormal
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data BufferState
= ReadBuffer
| WriteBuffer
data HandleType
= ClosedHandle
| SemiClosedHandle
| ReadHandle
| WriteHandle
| AppendHandle
| ReadWriteHandle
data HandleType
= ClosedHandle
| SemiClosedHandle
| ReadHandle
| WriteHandle
| AppendHandle
| ReadWriteHandle
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data Exception
= ArithException ArithException
| ArrayException ArrayException
| AssertionFailed String
| AsyncException AsyncException
| BlockedOnDeadMVar
| Deadlock
| DynException Dynamic
| ErrorCall String
| ExitException ExitCode
| IOException IOException
| NoMethodError String
| NonTermination
| PatternMatchFail String
| RecConError String
| RecSelError String
| RecUpdError String
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data HandleType
= ClosedHandle
| SemiClosedHandle
| ReadHandle
| WriteHandle
| AppendHandle
| ReadWriteHandle
data AsyncException
= StackOverflow
| HeapOverflow
| ThreadKilled
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data AsyncException
= StackOverflow
| HeapOverflow
| ThreadKilled
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data ArrayException
= IndexOutOfBounds String
| UndefinedElement String
data ArithException
= Overflow
| Underflow
| LossOfPrecision
| DivideByZero
| Denormal
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data IOErrorType
= AlreadyExists
| NoSuchThing
| ResourceBusy
| ResourceExhausted
| EOF
| IllegalOperation
| PermissionDenied
| UserError
| UnsatisfiedConstraints
| SystemError
| ProtocolError
| OtherError
| InvalidArgument
| InappropriateType
| HardwareFault
| UnsupportedOperation
| TimeExpired
| ResourceVanished
| Interrupted
| DynIOError Dynamic
data BufferState
= ReadBuffer
| WriteBuffer
data HandleType
= ClosedHandle
| SemiClosedHandle
| ReadHandle
| WriteHandle
| AppendHandle
| ReadWriteHandle
bindIO :: IO a -> (a -> IO b) -> IO b
data Buffer = Buffer {
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
}
data Buffer = Buffer {
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
}
data Buffer = Buffer {
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
}
data Buffer = Buffer {
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
}
data Buffer = Buffer {
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
}
bufferEmpty :: Buffer -> Bool
bufferFull :: Buffer -> Bool
bufferIsWritable :: Buffer -> Bool
failIO :: String -> IO a
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
data Handle__ = Handle__ {
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
}
heapOverflow :: Exception
ioError :: Exception -> IO a
ioException :: IOException -> IO a
ioToST :: IO a -> ST RealWorld a
data IOException = IOError {
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
}
data IOException = IOError {
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
}
data IOException = IOError {
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
}
data IOException = IOError {
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
}
data IOException = IOError {
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
}
liftIO :: IO a -> State# RealWorld -> STret RealWorld a
newIORef :: a -> IO (IORef a)
readIORef :: IORef a -> IO a
returnIO :: a -> IO a
stToIO :: ST RealWorld a -> IO a
stackOverflow :: Exception
thenIO :: IO a -> IO b -> IO b
throw :: Exception -> a
unIO :: IO a -> State# RealWorld -> (#State# RealWorld, a#)
unsafeInterleaveIO :: IO a -> IO a
unsafePerformIO :: IO a -> a
userError :: String -> IOError
writeIORef :: IORef a -> a -> IO ()
Documentation
data ArithException
The type of arithmetic exceptions
Constructors
Overflow
Underflow
LossOfPrecision
DivideByZero
Denormal
Instances
Typeable ArithException
Show ArithException
data ArrayException
Exceptions generated by array operations
Constructors
IndexOutOfBounds StringAn attempt was made to index an array outside its declared bounds.
UndefinedElement StringAn attempt was made to evaluate an element of an array that had not been initialized.
Instances
Typeable ArrayException
Show ArrayException
data AsyncException
Asynchronous exceptions
Constructors
StackOverflowThe current thread's stack exceeded its limit. Since an exception has been raised, the thread's stack will certainly be below its limit again, but the programmer should take remedial action immediately.
HeapOverflow

The program's heap is reaching its limit, and the program should take action to reduce the amount of live data it has. Notes:

  • It is undefined which thread receives this exception.

  • GHC currently does not throw HeapOverflow exceptions.

ThreadKilledThis exception is raised by another thread calling killThread, or by the system if it needs to terminate the thread for some reason.
Instances
Typeable AsyncException
Show AsyncException
data Buffer
Constructors
Buffer
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
data BufferList
Constructors
BufferListNil
BufferListCons RawBuffer BufferList
data BufferMode
Constructors
NoBuffering
LineBuffering
BlockBuffering (Maybe Int)
data BufferState
Constructors
ReadBuffer
WriteBuffer
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
Instances
Typeable Exception
Show Exception
Eq Exception
data ExitCode
Constructors
ExitSuccess
ExitFailure Int
type FD = Int
type FilePath = String
data Handle
Constructors
FileHandle !(MVar Handle__)
DuplexHandle !(MVar Handle__) !(MVar Handle__)
Instances
Typeable Handle
Eq Handle
Show Handle
data HandleType
Constructors
ClosedHandle
SemiClosedHandle
ReadHandle
WriteHandle
AppendHandle
ReadWriteHandle
Instances
Show HandleType
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
newtype IO a

A value of type IO a is a computation which, when performed, does some I/O before returning a value of type a.

There is really only one way to "perform" an I/O action: bind it to Main.main in your program. When your program is run, the I/O will be performed. It isn't possible to perform I/O from an arbitrary function, unless that function is itself in the IO monad and called at some point, directly or indirectly, from Main.main.

IO is a monad, so IO actions can be combined using either the do-notation or the >> and >>= operations from the Monad class.

Constructors
IO (State# RealWorld -> (#State# RealWorld, a#))
Instances
MonadPlus IO
MonadError IOError IO
MonadFix IO
MonadIO IO
MArray IOArray e IO
MArray IOUArray Bool IO
MArray IOUArray Char IO
MArray IOUArray Int IO
MArray IOUArray Word IO
MArray IOUArray (Ptr a) IO
MArray IOUArray (FunPtr a) IO
MArray IOUArray Float IO
MArray IOUArray Double IO
MArray IOUArray (StablePtr a) IO
MArray IOUArray Int8 IO
MArray IOUArray Int16 IO
MArray IOUArray Int32 IO
MArray IOUArray Int64 IO
MArray IOUArray Word8 IO
MArray IOUArray Word16 IO
MArray IOUArray Word32 IO
MArray IOUArray Word64 IO
(Storable e) => MArray StorableArray e IO
(Typeable a) => Typeable (IO a)
Functor IO
Monad IO
type IOError = Exception
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
Instances
Eq IOErrorType
Show IOErrorType
data IOException
Constructors
IOError
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
Instances
Typeable IOException
Eq IOException
Show IOException
newtype IORef a
A mutable variable in the IO monad
Constructors
IORef (STRef RealWorld a)
Instances
(Typeable a) => Typeable (IORef a)
data MVar a
An MVar (pronounced "em-var") is a synchronising variable, used for communication between concurrent threads. It can be thought of as a a box, which may be empty or full.
Constructors
MVar (MVar# RealWorld a)
Instances
Eq (MVar a)
type RawBuffer = MutableByteArray# RealWorld
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data HandleType
Constructors
ClosedHandle
SemiClosedHandle
ReadHandle
WriteHandle
AppendHandle
ReadWriteHandle
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data BufferMode
Constructors
NoBuffering
LineBuffering
BlockBuffering (Maybe Int)
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data Buffer
Constructors
Buffer
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
data BufferList
Constructors
BufferListNil
BufferListCons RawBuffer BufferList
data BufferList
Constructors
BufferListNil
BufferListCons RawBuffer BufferList
data HandleType
Constructors
ClosedHandle
SemiClosedHandle
ReadHandle
WriteHandle
AppendHandle
ReadWriteHandle
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data ArithException
The type of arithmetic exceptions
Constructors
Overflow
Underflow
LossOfPrecision
DivideByZero
Denormal
data ArithException
The type of arithmetic exceptions
Constructors
Overflow
Underflow
LossOfPrecision
DivideByZero
Denormal
data Handle
Constructors
FileHandle !(MVar Handle__)
DuplexHandle !(MVar Handle__) !(MVar Handle__)
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data ExitCode
Constructors
ExitSuccess
ExitFailure Int
data ExitCode
Constructors
ExitSuccess
ExitFailure Int
data Handle
Constructors
FileHandle !(MVar Handle__)
DuplexHandle !(MVar Handle__) !(MVar Handle__)
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data AsyncException
Asynchronous exceptions
Constructors
StackOverflowThe current thread's stack exceeded its limit. Since an exception has been raised, the thread's stack will certainly be below its limit again, but the programmer should take remedial action immediately.
HeapOverflow

The program's heap is reaching its limit, and the program should take action to reduce the amount of live data it has. Notes:

  • It is undefined which thread receives this exception.

  • GHC currently does not throw HeapOverflow exceptions.

ThreadKilledThis exception is raised by another thread calling killThread, or by the system if it needs to terminate the thread for some reason.
newtype IO a

A value of type IO a is a computation which, when performed, does some I/O before returning a value of type a.

There is really only one way to "perform" an I/O action: bind it to Main.main in your program. When your program is run, the I/O will be performed. It isn't possible to perform I/O from an arbitrary function, unless that function is itself in the IO monad and called at some point, directly or indirectly, from Main.main.

IO is a monad, so IO actions can be combined using either the do-notation or the >> and >>= operations from the Monad class.

Constructors
IO (State# RealWorld -> (#State# RealWorld, a#))
data IOException
Constructors
IOError
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
newtype IORef a
A mutable variable in the IO monad
Constructors
IORef (STRef RealWorld a)
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data ArrayException
Exceptions generated by array operations
Constructors
IndexOutOfBounds StringAn attempt was made to index an array outside its declared bounds.
UndefinedElement StringAn attempt was made to evaluate an element of an array that had not been initialized.
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data BufferMode
Constructors
NoBuffering
LineBuffering
BlockBuffering (Maybe Int)
data ArithException
The type of arithmetic exceptions
Constructors
Overflow
Underflow
LossOfPrecision
DivideByZero
Denormal
data MVar a
An MVar (pronounced "em-var") is a synchronising variable, used for communication between concurrent threads. It can be thought of as a a box, which may be empty or full.
Constructors
MVar (MVar# RealWorld a)
data BufferMode
Constructors
NoBuffering
LineBuffering
BlockBuffering (Maybe Int)
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data ArithException
The type of arithmetic exceptions
Constructors
Overflow
Underflow
LossOfPrecision
DivideByZero
Denormal
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data BufferState
Constructors
ReadBuffer
WriteBuffer
data HandleType
Constructors
ClosedHandle
SemiClosedHandle
ReadHandle
WriteHandle
AppendHandle
ReadWriteHandle
data HandleType
Constructors
ClosedHandle
SemiClosedHandle
ReadHandle
WriteHandle
AppendHandle
ReadWriteHandle
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data Exception

The type of exceptions. Every kind of system-generated exception has a constructor in the Exception type, and values of other types may be injected into Exception by coercing them to Dynamic (see the section on Dynamic Exceptions).

For backwards compatibility with Haskell 98, IOError is a type synonym for Exception.

Constructors
ArithException ArithExceptionExceptions raised by arithmetic operations. (NOTE: GHC currently does not throw ArithExceptions).
ArrayException ArrayExceptionExceptions raised by array-related operations. (NOTE: GHC currently does not throw ArrayExceptions).
AssertionFailed StringThis exception is thrown by the assert operation when the condition fails. The String argument contains the location of the assertion in the source program.
AsyncException AsyncExceptionAsynchronous exceptions (see section on Asynchronous Exceptions).
BlockedOnDeadMVarThe current thread was executing a call to takeMVar that could never return, because there are no other references to this MVar.
DeadlockThere are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only (see also: Control.Concurrent).
DynException DynamicDynamically typed exceptions (see section on Dynamic Exceptions).
ErrorCall StringThe ErrorCall exception is thrown by error. The String argument of ErrorCall is the string passed to error when it was called.
ExitException ExitCodeThe ExitException exception is thrown by exitWith (and exitFailure). The ExitCode argument is the value passed to exitWith. An unhandled ExitException exception in the main thread will cause the program to be terminated with the given exit code.
IOException IOExceptionThese are the standard IO exceptions generated by Haskell's IO operations. See also System.IO.Error.
NoMethodError StringAn attempt was made to invoke a class method which has no definition in this instance, and there was no default definition given in the class declaration. GHC issues a warning when you compile an instance which has missing methods.
NonTerminationThe current thread is stuck in an infinite loop. This exception may or may not be thrown when the program is non-terminating.
PatternMatchFail StringA pattern matching failure. The String argument should contain a descriptive message including the function name, source file and line number.
RecConError StringAn attempt was made to evaluate a field of a record for which no value was given at construction time. The String argument gives the location of the record construction in the source program.
RecSelError StringA field selection was attempted on a constructor that doesn't have the requested field. This can happen with multi-constructor records when one or more fields are missing from some of the constructors. The String argument gives the location of the record selection in the source program.
RecUpdError StringAn attempt was made to update a field in a record, where the record doesn't have the requested field. This can only occur with multi-constructor records, when one or more fields are missing from some of the constructors. The String argument gives the location of the record update in the source program.
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data HandleType
Constructors
ClosedHandle
SemiClosedHandle
ReadHandle
WriteHandle
AppendHandle
ReadWriteHandle
data AsyncException
Asynchronous exceptions
Constructors
StackOverflowThe current thread's stack exceeded its limit. Since an exception has been raised, the thread's stack will certainly be below its limit again, but the programmer should take remedial action immediately.
HeapOverflow

The program's heap is reaching its limit, and the program should take action to reduce the amount of live data it has. Notes:

  • It is undefined which thread receives this exception.

  • GHC currently does not throw HeapOverflow exceptions.

ThreadKilledThis exception is raised by another thread calling killThread, or by the system if it needs to terminate the thread for some reason.
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data AsyncException
Asynchronous exceptions
Constructors
StackOverflowThe current thread's stack exceeded its limit. Since an exception has been raised, the thread's stack will certainly be below its limit again, but the programmer should take remedial action immediately.
HeapOverflow

The program's heap is reaching its limit, and the program should take action to reduce the amount of live data it has. Notes:

  • It is undefined which thread receives this exception.

  • GHC currently does not throw HeapOverflow exceptions.

ThreadKilledThis exception is raised by another thread calling killThread, or by the system if it needs to terminate the thread for some reason.
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data ArrayException
Exceptions generated by array operations
Constructors
IndexOutOfBounds StringAn attempt was made to index an array outside its declared bounds.
UndefinedElement StringAn attempt was made to evaluate an element of an array that had not been initialized.
data ArithException
The type of arithmetic exceptions
Constructors
Overflow
Underflow
LossOfPrecision
DivideByZero
Denormal
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data IOErrorType
Constructors
AlreadyExists
NoSuchThing
ResourceBusy
ResourceExhausted
EOF
IllegalOperation
PermissionDenied
UserError
UnsatisfiedConstraints
SystemError
ProtocolError
OtherError
InvalidArgument
InappropriateType
HardwareFault
UnsupportedOperation
TimeExpired
ResourceVanished
Interrupted
DynIOError Dynamic
data BufferState
Constructors
ReadBuffer
WriteBuffer
data HandleType
Constructors
ClosedHandle
SemiClosedHandle
ReadHandle
WriteHandle
AppendHandle
ReadWriteHandle
bindIO :: IO a -> (a -> IO b) -> IO b
data Buffer
Constructors
Buffer
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
data Buffer
Constructors
Buffer
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
data Buffer
Constructors
Buffer
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
data Buffer
Constructors
Buffer
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
data Buffer
Constructors
Buffer
bufBuf :: RawBuffer
bufRPtr :: !Int
bufWPtr :: !Int
bufSize :: !Int
bufState :: BufferState
bufferEmpty :: Buffer -> Bool
bufferFull :: Buffer -> Bool
bufferIsWritable :: Buffer -> Bool
failIO :: String -> IO a
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
data Handle__
Constructors
Handle__
haFD :: !FD
haType :: HandleType
haIsBin :: Bool
haIsStream :: Bool
haBufferMode :: BufferMode
haFilePath :: FilePath
haBuffer :: !(IORef Buffer)
haBuffers :: !(IORef BufferList)
haOtherSide :: (Maybe (MVar Handle__))
heapOverflow :: Exception
ioError :: Exception -> IO a

A variant of throw that can be used within the IO monad.

Although ioError has a type that is an instance of the type of throw, the two functions are subtly different:

 throw e   `seq` return ()  ===> throw e
 ioError e `seq` return ()  ===> return ()

The first example will cause the exception e to be raised, whereas the second one won't. In fact, ioError will only cause an exception to be raised when it is used within the IO monad. The ioError variant should be used in preference to throw to raise an exception within the IO monad because it guarantees ordering with respect to other IO operations, whereas throw does not.

ioException :: IOException -> IO a
ioToST :: IO a -> ST RealWorld a
data IOException
Constructors
IOError
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
data IOException
Constructors
IOError
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
data IOException
Constructors
IOError
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
data IOException
Constructors
IOError
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
data IOException
Constructors
IOError
ioe_handle :: (Maybe Handle)
ioe_type :: IOErrorType
ioe_location :: String
ioe_descr :: String
ioe_filename :: (Maybe FilePath)
liftIO :: IO a -> State# RealWorld -> STret RealWorld a
newIORef :: a -> IO (IORef a)
Build a new IORef
readIORef :: IORef a -> IO a
Read the value of an IORef
returnIO :: a -> IO a
stToIO :: ST RealWorld a -> IO a
stackOverflow :: Exception
thenIO :: IO a -> IO b -> IO b
throw :: Exception -> a
Throw an exception. Exceptions may be thrown from purely functional code, but may only be caught within the IO monad.
unIO :: IO a -> State# RealWorld -> (#State# RealWorld, a#)
unsafeInterleaveIO :: IO a -> IO a
unsafeInterleaveIO allows IO computation to be deferred lazily. When passed a value of type IO a, the IO will only be performed when the value of the a is demanded. This is used to implement lazy file reading, see hGetContents.
unsafePerformIO :: IO a -> a

This is the back door into the IO monad, allowing IO computation to be performed at any time. For this to be safe, the IO computation should be free of side effects and independent of its environment.

If the I/O computation wrapped in unsafePerformIO performs side effects, then the relative order in which those side effects take place (relative to the main I/O trunk, or other calls to unsafePerformIO) is indeterminate.

However, it is less well known that unsafePerformIO is not type safe. For example:

     test :: IORef [a]
     test = unsafePerformIO $ newIORef []
     
     main = do
     	      writeIORef test [42]
     	      bang \<- readIORef test
     	      print (bang :: [Char])

This program will core dump. This problem with polymorphic references is well known in the ML community, and does not arise with normal monadic use of references. There is no easy way to make it impossible once you use unsafePerformIO. Indeed, it is possible to write coerce :: a -> b with the help of unsafePerformIO. So be careful!

userError :: String -> IOError
writeIORef :: IORef a -> a -> IO ()
Write a new value into an IORef
Produced by Haddock version 0.3