From 3d48923635e488973076739682f12c3452efdd2f Mon Sep 17 00:00:00 2001
From: Michael Snoyman <michael@snoyman.com>
Date: Sun, 11 Feb 2018 18:48:11 +0200
Subject: [PATCH] More consistent generalBracket implementations

The behavior is identical to before, but since I'm about to use these
instances in the docs, I wanted to raise less confusing questions to
readers about implementation.
---
 src/Control/Monad/Catch.hs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Control/Monad/Catch.hs b/src/Control/Monad/Catch.hs
index 3677ebf..9f1c0f2 100644
--- a/src/Control/Monad/Catch.hs
+++ b/src/Control/Monad/Catch.hs
@@ -474,8 +474,8 @@ instance (Error e, MonadMask m) => MonadMask (ErrorT e m) where
           Right resource -> runErrorT (release resource) >> return ())
       (\eresource e ->
          case eresource of
-           Left _ -> throwM e
-           Right resource -> runErrorT (cleanup resource e))
+           Left _ -> return ()
+           Right resource -> runErrorT (cleanup resource e) >> return ())
       (either (return . Left) (runErrorT . use))
 
 -- | Throws exceptions into the base monad.
@@ -505,8 +505,8 @@ instance MonadMask m => MonadMask (ExceptT e m) where
           Right resource -> runExceptT (release resource) >> return ())
       (\eresource e ->
          case eresource of
-           Left _ -> throwM e
-           Right resource -> runExceptT (cleanup resource e))
+           Left _ -> return ()
+           Right resource -> runExceptT (cleanup resource e) >> return ())
       (either (return . Left) (runExceptT . use))
 
 instance MonadThrow m => MonadThrow (ContT r m) where
-- 
GitLab