HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulererebase-1.21.2Haskell2010

GHC.IO.Exception

  • 14 types
  • 16 values
  • Packagererebase-1.21.2
  • Exports30
  • LanguageHaskell2010
  • LicenceMIT
  • SourceException.hs
valueuserError :: String -> IOError
#

Construct an IOError value with a string describing the error. The fail method of the IO instance of the Monad class raises a userError, thus:

instance Monad IO where
  ...
  fail s = ioError (userError s)
datadata ArrayException
#

Exceptions generated by array operations

Constructors

Instances4Eq, Ord, Show, Exception
datadata AsyncException
#

Asynchronous exceptions.

Constructors

  • StackOverflow

    The 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 throws this to the same thread that receives UserInterrupt, but this may change in the future.

    • The GHC RTS currently can only recover from heap overflow if it detects that an explicit memory limit (set via RTS flags). has been exceeded. Currently, failure to allocate memory from the operating system results in immediate termination of the program.

  • ThreadKilled

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

  • UserInterrupt

    This exception is raised by default in the main thread of the program when the user requests to terminate the program via the usual mechanism(s) (e.g. Control-C in the console).

Instances4Eq, Ord, Show, Exception
datadata Deadlock
#

There are no runnable threads, so the program is deadlocked. The Deadlock exception is raised in the main thread only.

Instances2Show, Exception
  • Show DeadlockDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Exception
  • Exception DeadlockDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Exception
datadata ExitCode
#

Defines the exit codes that a program can return.

Constructors

  • ExitSuccess

    indicates successful termination;

  • ExitFailure Int

    indicates program failure with an exit code. The exact interpretation of the code is operating-system dependent. In particular, some values may be prohibited (e.g. 0 on a POSIX-compliant system).

Instances8Eq, Ord, Read, Show, Generic, Exception, …
typetype IOError = IOException
#

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

In Haskell 2010, this is an opaque type.

datadata IOException
#

Exceptions that occur in the IO monad. An IOException records a more specific error type, a descriptive string and maybe the handle that was used when the error was flagged.

Constructors

Instances4Eq, Show, Exception, MonadError
datadata IOErrorType
#
Instances2Eq, Show
  • Eq IOErrorTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Exception
  • Show IOErrorTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Exception