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
- 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 # |
Methods (>>=) :: UIO a -> (a -> UIO b) -> UIO b # (>>) :: UIO a -> UIO b -> UIO b # return :: a -> UIO a # fail :: String -> UIO a #
Functor UIO # |
Methods fmap :: (a -> b) -> UIO a -> UIO b # (<$) :: a -> UIO b -> UIO a #
MonadFix UIO # |
Methods mfix :: (a -> UIO a) -> UIO a #
Applicative UIO # |
Methods pure :: a -> UIO a # (<*>) :: UIO (a -> b) -> UIO a -> UIO b # (*>) :: UIO a -> UIO b -> UIO b # (<*) :: UIO a -> UIO b -> UIO a #
Unexceptional UIO # |
Methods liftUIO :: UIO a -> UIO a #

class Unexceptional m where #

Polymorphic base without any non-error, synchronous exceptions

Minimal complete definition

liftUIO

Methods

liftUIO :: UIO a -> m a #

Instances

Unexceptional IO # |
Methods liftUIO :: UIO a -> IO a #
Unexceptional UIO # |
Methods liftUIO :: UIO a -> UIO a #

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`