extensible-exceptions
Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilitynon-portable (uses ExistentialQuantification and DeriveDataTypeable)
Safe HaskellTrustworthy
LanguageHaskell98

Control.Exception.Extensible

Description

This module provides the extensible exceptions API for raising and catching both built-in and user-defined exceptions.

For newer versions of GHC (>=6.9), this package re-exports Exception. Otherwise, it provides a compatibility layer around the previous version of the extensions API.

Documentation

assert :: Bool -> a -> a #

throwTo :: Exception e => ThreadId -> e -> IO () #

allowInterrupt :: IO () #

catches :: IO a -> [Handler a] -> IO a #

bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c #

bracketOnError :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c #

bracket_ :: IO a -> IO b -> IO c -> IO c #

catchJust :: Exception e => (e -> Maybe b) -> IO a -> (b -> IO a) -> IO a #

finally :: IO a -> IO b -> IO a #

handle :: Exception e => (e -> IO a) -> IO a -> IO a #

handleJust :: Exception e => (e -> Maybe b) -> (b -> IO a) -> IO a -> IO a #

mapException :: (Exception e1, Exception e2) => (e1 -> e2) -> a -> a #

onException :: IO a -> IO b -> IO a #

try :: Exception e => IO a -> IO (Either e a) #

tryJust :: Exception e => (e -> Maybe b) -> IO a -> IO (Either b a) #

tryWithContext :: Exception e => IO a -> IO (Either (ExceptionWithContext e) a) #

throw :: forall a e. (HasCallStack, Exception e) => e -> a #

addExceptionContext :: ExceptionAnnotation a => a -> SomeException -> SomeException #

someExceptionContext :: SomeException -> ExceptionContext #

annotateIO :: ExceptionAnnotation e => e -> IO a -> IO a #

catch :: Exception e => IO a -> (e -> IO a) -> IO a #

catchNoPropagate :: Exception e => IO a -> (ExceptionWithContext e -> IO a) -> IO a #

evaluate :: a -> IO a #

interruptible :: IO a -> IO a #

mask :: ((forall a. IO a -> IO a) -> IO b) -> IO b #

mask_ :: IO a -> IO a #

throwIO :: (HasCallStack, Exception e) => e -> IO a #

uninterruptibleMask :: ((forall a. IO a -> IO a) -> IO b) -> IO b #

uninterruptibleMask_ :: IO a -> IO a #

ioError :: HasCallStack => IOError -> IO a #

data Handler a #

Constructors

Exception e => Handler (e -> IO a) 

Instances

Instances details
Functor Handler # 
Instance details

Defined in GHC.Internal.Control.Exception

Methods

fmap :: (a -> b) -> Handler a -> Handler b

(<$) :: a -> Handler b -> Handler a

newtype NoMethodError #

Constructors

NoMethodError String 

Instances

Instances details
Exception NoMethodError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Show NoMethodError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Methods

showsPrec :: Int -> NoMethodError -> ShowS

show :: NoMethodError -> String

showList :: [NoMethodError] -> ShowS

data NonTermination #

Constructors

NonTermination 

Instances

Instances details
Exception NonTermination # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Show NonTermination # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Methods

showsPrec :: Int -> NonTermination -> ShowS

show :: NonTermination -> String

showList :: [NonTermination] -> ShowS

newtype RecConError #

Constructors

RecConError String 

Instances

Instances details
Exception RecConError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Show RecConError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Methods

showsPrec :: Int -> RecConError -> ShowS

show :: RecConError -> String

showList :: [RecConError] -> ShowS

newtype RecSelError #

Constructors

RecSelError String 

Instances

Instances details
Exception RecSelError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Show RecSelError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Methods

showsPrec :: Int -> RecSelError -> ShowS

show :: RecSelError -> String

showList :: [RecSelError] -> ShowS

newtype RecUpdError #

Constructors

RecUpdError String 

Instances

Instances details
Exception RecUpdError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Show RecUpdError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Methods

showsPrec :: Int -> RecUpdError -> ShowS

show :: RecUpdError -> String

showList :: [RecUpdError] -> ShowS

newtype TypeError #

Constructors

TypeError String 

Instances

Instances details
Exception TypeError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Show TypeError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Methods

showsPrec :: Int -> TypeError -> ShowS

show :: TypeError -> String

showList :: [TypeError] -> ShowS

data ErrorCall #

Constructors

ErrorCall String 

Bundled Patterns

pattern ErrorCallWithLocation :: String -> String -> ErrorCall 

Instances

Instances details
Exception ErrorCall # 
Instance details

Defined in GHC.Internal.Exception

Show ErrorCall # 
Instance details

Defined in GHC.Internal.Exception

Methods

showsPrec :: Int -> ErrorCall -> ShowS

show :: ErrorCall -> String

showList :: [ErrorCall] -> ShowS

Eq ErrorCall # 
Instance details

Defined in GHC.Internal.Exception

Methods

(==) :: ErrorCall -> ErrorCall -> Bool

(/=) :: ErrorCall -> ErrorCall -> Bool

Ord ErrorCall # 
Instance details

Defined in GHC.Internal.Exception

Methods

compare :: ErrorCall -> ErrorCall -> Ordering

(<) :: ErrorCall -> ErrorCall -> Bool

(<=) :: ErrorCall -> ErrorCall -> Bool

(>) :: ErrorCall -> ErrorCall -> Bool

(>=) :: ErrorCall -> ErrorCall -> Bool

max :: ErrorCall -> ErrorCall -> ErrorCall

min :: ErrorCall -> ErrorCall -> ErrorCall

class (Typeable e, Show e) => Exception e where #

Minimal complete definition

Nothing

Methods

toException :: e -> SomeException #

fromException :: SomeException -> Maybe e #

displayException :: e -> String #

backtraceDesired :: e -> Bool #

Instances

Instances details
Exception Timeout # 
Instance details

Defined in System.Timeout

Methods

toException :: Timeout -> SomeException #

fromException :: SomeException -> Maybe Timeout #

displayException :: Timeout -> String #

backtraceDesired :: Timeout -> Bool #

Exception Void # 
Instance details

Defined in GHC.Internal.Exception.Type

Methods

toException :: Void -> SomeException #

fromException :: SomeException -> Maybe Void #

displayException :: Void -> String #

backtraceDesired :: Void -> Bool #

Exception NestedAtomically # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Exception NoMatchingContinuationPrompt # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Methods

toException :: NoMatchingContinuationPrompt -> SomeException #

fromException :: SomeException -> Maybe NoMatchingContinuationPrompt #

displayException :: NoMatchingContinuationPrompt -> String #

backtraceDesired :: NoMatchingContinuationPrompt -> Bool #

Exception NoMethodError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Exception NonTermination # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Exception PatternMatchFail # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Exception RecConError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Exception RecSelError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Exception RecUpdError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Exception TypeError # 
Instance details

Defined in GHC.Internal.Control.Exception.Base

Exception ErrorCall # 
Instance details

Defined in GHC.Internal.Exception

Exception ArithException # 
Instance details

Defined in GHC.Internal.Exception.Type

Exception SomeException # 
Instance details

Defined in GHC.Internal.Exception.Type

Exception AllocationLimitExceeded # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception ArrayException # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception AssertionFailed # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception AsyncException # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception BlockedIndefinitelyOnMVar # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception BlockedIndefinitelyOnSTM # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception CompactionFailed # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception Deadlock # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception ExitCode # 
Instance details

Defined in GHC.Internal.IO.Exception

Methods

toException :: ExitCode -> SomeException #

fromException :: SomeException -> Maybe ExitCode #

displayException :: ExitCode -> String #

backtraceDesired :: ExitCode -> Bool #

Exception FixIOException # 
Instance details

Defined in GHC.Internal.IO.Exception

Methods

toException :: FixIOException -> SomeException #

fromException :: SomeException -> Maybe FixIOException #

displayException :: FixIOException -> String #

backtraceDesired :: FixIOException -> Bool #

Exception IOException # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception SomeAsyncException # 
Instance details

Defined in GHC.Internal.IO.Exception

Exception a => Exception (ExceptionWithContext a) # 
Instance details

Defined in GHC.Internal.Exception.Type

Exception e => Exception (NoBacktrace e) # 
Instance details

Defined in GHC.Internal.Exception.Type

data ExceptionWithContext a #

Constructors

ExceptionWithContext ExceptionContext a 

Instances

Instances details
Exception a => Exception (ExceptionWithContext a) # 
Instance details

Defined in GHC.Internal.Exception.Type

Show a => Show (ExceptionWithContext a) # 
Instance details

Defined in GHC.Internal.Exception.Type

Methods

showsPrec :: Int -> ExceptionWithContext a -> ShowS

show :: ExceptionWithContext a -> String

showList :: [ExceptionWithContext a] -> ShowS

newtype NoBacktrace e #

Constructors

NoBacktrace e 

Instances

Instances details
Exception e => Exception (NoBacktrace e) # 
Instance details

Defined in GHC.Internal.Exception.Type

Show e => Show (NoBacktrace e) # 
Instance details

Defined in GHC.Internal.Exception.Type

Methods

showsPrec :: Int -> NoBacktrace e -> ShowS

show :: NoBacktrace e -> String

showList :: [NoBacktrace e] -> ShowS

data SomeException #

Constructors

(Exception e, HasExceptionContext) => SomeException e 

Instances

Instances details
Exception SomeException # 
Instance details

Defined in GHC.Internal.Exception.Type

Show SomeException # 
Instance details

Defined in GHC.Internal.Exception.Type

Methods

showsPrec :: Int -> SomeException -> ShowS

show :: SomeException -> String

showList :: [SomeException] -> ShowS

data WhileHandling #

Instances

Instances details
ExceptionAnnotation WhileHandling # 
Instance details

Defined in GHC.Internal.Exception.Type

Show WhileHandling # 
Instance details

Defined in GHC.Internal.Exception.Type

Methods

showsPrec :: Int -> WhileHandling -> ShowS

show :: WhileHandling -> String

showList :: [WhileHandling] -> ShowS

data MaskingState #

Instances

Instances details
Show MaskingState # 
Instance details

Defined in GHC.Internal.IO

Methods

showsPrec :: Int -> MaskingState -> ShowS

show :: MaskingState -> String

showList :: [MaskingState] -> ShowS

Eq MaskingState # 
Instance details

Defined in GHC.Internal.IO

Methods

(==) :: MaskingState -> MaskingState -> Bool

(/=) :: MaskingState -> MaskingState -> Bool

newtype AssertionFailed #

Constructors

AssertionFailed String 

Instances

Instances details
Exception AssertionFailed # 
Instance details

Defined in GHC.Internal.IO.Exception

Show AssertionFailed # 
Instance details

Defined in GHC.Internal.IO.Exception

Methods

showsPrec :: Int -> AssertionFailed -> ShowS

show :: AssertionFailed -> String

showList :: [AssertionFailed] -> ShowS

newtype CompactionFailed #

Constructors

CompactionFailed String 

Instances

Instances details
Exception CompactionFailed # 
Instance details

Defined in GHC.Internal.IO.Exception

Show CompactionFailed # 
Instance details

Defined in GHC.Internal.IO.Exception

Methods

showsPrec :: Int -> CompactionFailed -> ShowS

show :: CompactionFailed -> String

showList :: [CompactionFailed] -> ShowS

data Deadlock #

Constructors

Deadlock 

Instances

Instances details
Exception Deadlock # 
Instance details

Defined in GHC.Internal.IO.Exception

Show Deadlock # 
Instance details

Defined in GHC.Internal.IO.Exception

Methods

showsPrec :: Int -> Deadlock -> ShowS

show :: Deadlock -> String

showList :: [Deadlock] -> ShowS

data IOException #

Instances

Instances details
Exception IOException # 
Instance details

Defined in GHC.Internal.IO.Exception

Show IOException # 
Instance details

Defined in GHC.Internal.IO.Exception

Methods

showsPrec :: Int -> IOException -> ShowS

show :: IOException -> String

showList :: [IOException] -> ShowS

Eq IOException # 
Instance details

Defined in GHC.Internal.IO.Exception

Methods

(==) :: IOException -> IOException -> Bool

(/=) :: IOException -> IOException -> Bool