move tryError to Simplex.Messaging.Util (#191)

This commit is contained in:
Evgeny Poberezkin authored and GitHub committed 2021-09-04 19:01:54 +01:00
1 parent 2ac903a2dd
commit e07bedac0e
2 files changed
+4 -2

No files matched your search

+3
View File
@@ -50,3 +50,6 @@ liftError f = liftEitherError f . runExceptT
liftEitherError :: (MonadIO m, MonadError e' m) => (e -> e') -> IO (Either e a) -> m a
liftEitherError f a = liftIOEither (first f <$> a)
tryError :: MonadError e m => m a -> m (Either e a)
tryError action = (Right <$> action) `catchError` (pure . Left)