module Control.Exception.Value ( eitherThrow
                               , eitherThrowIO
                               , maybeThrowIO
                               ) where

import           Control.Exception (Exception, throw, throwIO)

eitherThrow :: Exception e => Either e x -> x
eitherThrow :: forall e x. Exception e => Either e x -> x
eitherThrow = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall a e. Exception e => e -> a
throw forall a. a -> a
id

eitherThrowIO :: Exception e => Either e x -> IO x
eitherThrowIO :: forall e x. Exception e => Either e x -> IO x
eitherThrowIO = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall e a. Exception e => e -> IO a
throwIO forall (f :: * -> *) a. Applicative f => a -> f a
pure

maybeThrowIO :: Exception e => Maybe e -> IO ()
maybeThrowIO :: forall e. Exception e => Maybe e -> IO ()
maybeThrowIO (Just e
e) = forall e a. Exception e => e -> IO a
throwIO e
e
maybeThrowIO Maybe e
Nothing  = forall (f :: * -> *) a. Applicative f => a -> f a
pure ()