pfile-0.1.0.1: CLI program for profiles management.
Copyright(c) 2024 Illia Shkroba
LicenseBSD3
MaintainerIllia Shkroba <[email protected]>
Stabilityunstable
Portabilitynon-portable (Non-Unix systems are not supported)
Safe HaskellSafe-Inferred
LanguageHaskell2010

PFile.Error

Description

Functions for error handling.

Synopsis

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

fallback :: Monad m => (e -> w -> m b) -> ExceptT e (WriterT w m) a -> m w Source #

When ExceptT e (WriterT w m) throws an error, pass its error e and writer's result w to (e -> w -> m b) function. A result of (e -> w -> m b) is ignored. Always return w.

Since: 0.1.0.0

untilError :: Functor m => ExceptT e (WriterT w m) a -> m (Maybe e, w) Source #

Unpack ExceptT e (WriterT w m). A result a of ExceptT e (WriterT w m) a is ignored.

Since: 0.1.0.0