Skip to content

Instantly share code, notes, and snippets.

@singpolyma
Created September 2, 2014 20:46
Show Gist options
  • Select an option

  • Save singpolyma/2bb4021a6caaba34c2cb to your computer and use it in GitHub Desktop.

Select an option

Save singpolyma/2bb4021a6caaba34c2cb to your computer and use it in GitHub Desktop.
Control.Error.UnexceptionalIO
module Control.Error.UnexceptionalIO (
UIO.UnexceptionalIO,
UIO.UIO,
fromIO,
runUnexceptionalIO,
runEitherIO,
fromIO',
UIO.unsafeFromIO,
syncIO
) where
import Control.Monad.Trans.Either (EitherT(..), runEitherT)
import Control.Exception (SomeException, Exception)
import Control.Monad.IO.Class (MonadIO, liftIO)
import UnexceptionalIO (UnexceptionalIO)
import qualified UnexceptionalIO as UIO
fromIO :: IO a -> EitherT SomeException UnexceptionalIO a
fromIO = EitherT . UIO.fromIO
runUnexceptionalIO :: (MonadIO m) => UnexceptionalIO a -> m a
runUnexceptionalIO = liftIO . UIO.runUnexceptionalIO
runEitherIO :: (MonadIO m, Exception e) => EitherT e UnexceptionalIO a -> m a
runEitherIO = liftIO . UIO.runEitherIO . runEitherT
fromIO' :: Exception e => IO a -> EitherT e UnexceptionalIO a
fromIO' = EitherT . UIO.fromIO'
syncIO :: IO a -> EitherT SomeException IO a
syncIO = EitherT . UIO.syncIO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment