ghc-internal-9.1001.0: Basic libraries
Copyright(c) The University of Glasgow 2009
Licensesee libraries/base/LICENSE
Maintainerlibraries@haskell.org
Stabilityinternal
Portabilitynon-portable
Safe HaskellTrustworthy
LanguageHaskell2010

GHC.Internal.IO.Exception

Description

IO-related Exception types and functions

The API of this module is unstable and not meant to be consumed by the general public. If you absolutely must depend on it, make sure to use a tight upper bound, e.g., base < 4.X rather than base < 5, because the interface can change rapidly without much warning.

Synopsis

Documentation

data BlockedIndefinitelyOnSTM Source #

The thread is waiting to retry an STM transaction, but there are no other references to any TVars involved, so it can't ever continue.

data Deadlock Source #

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

Constructors

Deadlock 

newtype CompactionFailed Source #

Compaction found an object that cannot be compacted. Functions cannot be compacted, nor can mutable objects or pinned objects. See compact.

@since base-4.10.0.0

Constructors

CompactionFailed String 

asyncExceptionToException :: Exception e => e -> SomeException Source #

@since base-4.7.0.0

data AsyncException Source #

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).

data ArrayException Source #

Exceptions generated by array operations

Constructors

IndexOutOfBounds String

An attempt was made to index an array outside its declared bounds.

UndefinedElement String

An attempt was made to evaluate an element of an array that had not been initialized.

data ExitCode Source #

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).

Instances

Instances details
Exception ExitCode Source #

@since base-4.1.0.0

Instance details

Defined in GHC.Internal.IO.Exception

Generic ExitCode Source # 
Instance details

Defined in GHC.Internal.IO.Exception

Associated Types

type Rep ExitCode 
Instance details

Defined in GHC.Internal.IO.Exception

type Rep ExitCode = D1 ('MetaData "ExitCode" "GHC.Internal.IO.Exception" "ghc-internal" 'False) (C1 ('MetaCons "ExitSuccess" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExitFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))
Read ExitCode Source # 
Instance details

Defined in GHC.Internal.IO.Exception

Show ExitCode Source # 
Instance details

Defined in GHC.Internal.IO.Exception

Eq ExitCode Source # 
Instance details

Defined in GHC.Internal.IO.Exception

Ord ExitCode Source # 
Instance details

Defined in GHC.Internal.IO.Exception

type Rep ExitCode Source # 
Instance details

Defined in GHC.Internal.IO.Exception

type Rep ExitCode = D1 ('MetaData "ExitCode" "GHC.Internal.IO.Exception" "ghc-internal" 'False) (C1 ('MetaCons "ExitSuccess" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ExitFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

data FixIOException Source #

The exception thrown when an infinite cycle is detected in fixIO.

@since base-4.11.0.0

Constructors

FixIOException 

ioError :: IOError -> IO a Source #

Raise an IOError in the IO monad.

type IOError = IOException Source #

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.

data IOException Source #

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

IOError 

Fields

userError :: String -> IOError Source #

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)

assertError :: (?callStack :: CallStack) => Bool -> a -> a Source #