diff --git a/src/Utils.hs b/src/Utils.hs index 9567d12c9..259cfea21 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -883,6 +883,11 @@ whenIsRight (Left _) _ = pure () throwLeft :: (MonadThrow m, Exception exc) => Either exc a -> m a throwLeft = either throwM return +throwLeftWith :: (MonadThrow m, Exception e) => e -> Either b a -> m a +-- throwLeftWith e = either (const $ throwM e) return +throwLeftWith _ (Right x) = return x +throwLeftWith e (Left _) = throwM e + {- Just a reminder for Steffen: mapLeft :: (a -> c) -> Either a b -> Either c b mapLeft = over _Left