UnexceptionalIO

unexceptionalio-0.3.0: IO without any non-error, synchronous exceptions

Safe Haskell | Safe
Language | Haskell98

UnexceptionalIO

Contents

- Unsafe entry points
- Utilities

Description

When you've caught all the exceptions that can be handled safely, this is what you're left with.

    runEitherIO . fromIO ≡ id

Synopsis

- data UIO a
- class Unexceptional m where
  - liftUIO :: UIO a -> m a
- fromIO :: IO a -> UIO (Either SomeException a)
- runUIO :: UIO a -> IO a
- runEitherIO :: Exception e => UIO (Either e a) -> IO a
- fromIO' :: Exception e => IO a -> UIO (Either e a)
- unsafeFromIO :: IO a -> UIO a
- syncIO :: IO a -> IO (Either SomeException a)

# Documentation

data UIO a

IO without any non-error, synchronous exceptions

Instances

Monad UIO |
Functor UIO |
MonadFix UIO |
Applicative UIO |
Unexceptional UIO |

class Unexceptional m where

Polymorphic base without any non-error, synchronous exceptions

Methods

liftUIO :: UIO a -> m a

Instances

Unexceptional IO |
Unexceptional UIO |

fromIO :: IO a -> UIO (Either SomeException a)

Catch any non-error, synchronous exceptions in an `IO` action

runUIO :: UIO a -> IO a

Re-embed `UIO` into `IO`

runEitherIO :: Exception e => UIO (Either e a) -> IO a

Re-embed `UIO` and possible exception back into `IO`

# Unsafe entry points

fromIO' :: Exception e => IO a -> UIO (Either e a)

You promise that `e` covers all non-error, synchronous exceptions thrown by this `IO` action

This function is partial if you lie

unsafeFromIO :: IO a -> UIO a

You promise there are no exceptions thrown by this `IO` action

# Utilities

syncIO :: IO a -> IO (Either SomeException a)

Catch all exceptions, except for asynchronous exceptions found in `base`