Hackage.Security.Util.Checked

hackage-security-0.5.2.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 #

Checked exceptions

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

## Base exceptions

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

Throw a checked exception

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

Catch a checked exception

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

`catchChecked` with the arguments reversed

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

Like `try`, but for checked exceptions

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

Rethrow IO exceptions as checked exceptions

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

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 #

Variation on `throwUnchecked` for internal errors