| Copyright | (c) 2024 Illia Shkroba |
|---|---|
| License | BSD3 |
| Maintainer | Illia Shkroba <is@pjwstk.edu.pl> |
| Stability | unstable |
| Portability | non-portable (Non-Unix systems are not supported) |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
PFile.Error
Description
Functions for error handling.
Synopsis
- modifyError :: MonadError e2 m => (e1 -> e2) -> ExceptT e1 m a -> m a
- tellError :: MonadWriter [e2] m => (e1 -> e2) -> ExceptT e1 m a -> m ()
- liftIOWithError :: (MonadError e m, MonadIO m) => IO a -> (IOException -> e) -> m a
- onIOError :: IO a -> IO a -> IO a
- consumeWriterT :: Monad m => (w -> m ()) -> ExceptT e (WriterT w m) a -> ExceptT e m a
- fallback :: Monad m => (e -> w -> m b) -> ExceptT e (WriterT w m) a -> m w
- untilError :: Functor m => ExceptT e (WriterT w m) a -> m (Maybe e, w)
Documentation
modifyError :: MonadError e2 m => (e1 -> e2) -> ExceptT e1 m a -> m a Source #
Modify error in ExceptT e1 m with a (e1 -> e2) function and then
throwError the new error in m.
Since: 0.1.0.0
tellError :: MonadWriter [e2] m => (e1 -> e2) -> ExceptT e1 m a -> m () Source #
Modify error in ExceptT e1 m with a (e1 -> e2) function and then
tell the new error as a singleton list in m.
Since: 0.1.0.0
liftIOWithError :: (MonadError e m, MonadIO m) => IO a -> (IOException -> e) -> m a Source #
Catch IOException of IO, modify it with a (IOException -> e)
function and then throwError the new error in m (lifted IO).
Since: 0.1.0.0
onIOError :: IO a -> IO a -> IO a Source #
Catch IOException of the first IO, ignore it and call the second IO.
The second IO will not be called if the first IO doesn't throw.
Since: 0.1.0.0
consumeWriterT :: Monad m => (w -> m ()) -> ExceptT e (WriterT w m) a -> ExceptT e m a Source #
Unpack inner WriterT w m of ExceptT e (WriterT w m) and consume its
w with (w -> m ()) function.
Since: 0.1.0.0