hackage-security-0.6.3.2: Hackage security library

Safe Haskell | None
Language | Haskell2010

Hackage.Security.Util.Checked

Contents

- Base exceptions

Description

Checked exceptions

Synopsis

- class Throws e
- unthrow :: forall a e proxy. proxy e -> (Throws e => a) -> a
- throwChecked :: (Exception e, Throws e) => e -> IO a
- catchChecked :: forall a e. Exception e => (Throws e => IO a) -> (e -> IO a) -> IO a
- handleChecked :: Exception e => (e -> IO a) -> (Throws e => IO a) -> IO a
- tryChecked :: Exception e => (Throws e => IO a) -> IO (Either e a)
- checkIO :: Throws IOException => IO a -> IO a
- throwUnchecked :: Exception e => e -> IO a
- internalError :: String -> IO a

# Documentation

class Throws e Source #

Checked exceptions

unthrow :: forall a e proxy. proxy e -> (Throws e => a) -> a Source #

## Base exceptions

throwChecked :: (Exception e, Throws e) => e -> IO a Source #

Throw a checked exception

catchChecked :: forall a e. Exception e => (Throws e => IO a) -> (e -> IO a) -> IO a Source #

Catch a checked exception

handleChecked :: Exception e => (e -> IO a) -> (Throws e => IO a) -> IO a Source #

`catchChecked` with the arguments reversed

tryChecked :: Exception e => (Throws e => IO a) -> IO (Either e a) Source #

Like `try`, but for checked exceptions

checkIO :: Throws IOException => IO a -> IO a Source #

Rethrow IO exceptions as checked exceptions

throwUnchecked :: Exception e => e -> IO a Source #

Throw an unchecked exception

This is just an alias for `throw`, but makes it evident that this is a very intentional use of an unchecked exception.

internalError :: String -> IO a Source #

Variation on `throwUnchecked` for internal errors