From 44ff4aeb258ae0dd46361e233779c657870f7b35 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 15 Jul 2019 15:58:06 -0400 Subject: [PATCH 1/3] Fix a URL. --- fused-effects-exceptions.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fused-effects-exceptions.cabal b/fused-effects-exceptions.cabal index dfa63e8..c6cd9c4 100644 --- a/fused-effects-exceptions.cabal +++ b/fused-effects-exceptions.cabal @@ -4,7 +4,7 @@ name: fused-effects-exceptions version: 0.2.0.0 synopsis: Handle exceptions thrown in IO with fused-effects. description: Provides an effect that enables catching exceptions thrown from impure computations such as 'IO'. -homepage: https://github.com/patrickt/fused-effects-exceptions#readme +homepage: https://github.com/fused-effects/fused-effects-exceptions#readme license: BSD-3-Clause license-file: LICENSE author: Josh Vera From 06a867679d3ab366b0de6ad32f5f46337d6923e9 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 15 Jul 2019 16:02:09 -0400 Subject: [PATCH 2/3] Rename runCatch to unliftCatch. --- src/Control/Effect/Catch.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Control/Effect/Catch.hs b/src/Control/Effect/Catch.hs index 662a381..4cd5683 100644 --- a/src/Control/Effect/Catch.hs +++ b/src/Control/Effect/Catch.hs @@ -13,7 +13,6 @@ module Control.Effect.Catch ( Catch (..) , catch , catchSync - , runCatch , withCatch , CatchC (..) ) where @@ -63,10 +62,10 @@ catchSync f g = f `catch` \e -> else liftIO (Exc.throw e) -- | Evaluate a 'Catch' effect. -runCatch :: (forall x . m x -> IO x) - -> CatchC m a - -> m a -runCatch handler = runReader (Handler handler) . runCatchC +unliftCatch :: (forall x . m x -> IO x) + -> CatchC m a + -> m a +unliftCatch handler = runReader (Handler handler) . runCatchC -- | Evaluate a 'Catch' effect, using 'MonadUnliftIO' to infer a correct -- unlifting function. @@ -83,7 +82,7 @@ newtype CatchC m a = CatchC { runCatchC :: ReaderC (Handler m) m a } instance MonadUnliftIO m => MonadUnliftIO (CatchC m) where askUnliftIO = CatchC . ReaderC $ \(Handler h) -> - withUnliftIO $ \u -> pure (UnliftIO $ \r -> unliftIO u (runCatch h r)) + withUnliftIO $ \u -> pure (UnliftIO $ \r -> unliftIO u (unliftCatch h r)) instance (Carrier sig m, MonadIO m) => Carrier (Catch :+: sig) (CatchC m) where eff (L (CatchIO act cleanup k)) = do From 073f8199dcd317970c10acf14e208316fdc8503b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 15 Jul 2019 16:02:23 -0400 Subject: [PATCH 3/3] Rename withCatch to runCatch. --- src/Control/Effect/Catch.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Control/Effect/Catch.hs b/src/Control/Effect/Catch.hs index 4cd5683..3bebac4 100644 --- a/src/Control/Effect/Catch.hs +++ b/src/Control/Effect/Catch.hs @@ -13,7 +13,7 @@ module Control.Effect.Catch ( Catch (..) , catch , catchSync - , withCatch + , runCatch , CatchC (..) ) where @@ -69,8 +69,8 @@ unliftCatch handler = runReader (Handler handler) . runCatchC -- | Evaluate a 'Catch' effect, using 'MonadUnliftIO' to infer a correct -- unlifting function. -withCatch :: MonadUnliftIO m => CatchC m a -> m a -withCatch c = withRunInIO (\f -> runHandler (Handler f) c) +runCatch :: MonadUnliftIO m => CatchC m a -> m a +runCatch c = withRunInIO (\f -> runHandler (Handler f) c) newtype Handler m = Handler (forall x . m x -> IO x)