Skip to content

Commit f3bb5d7

Browse files
authored
Merge pull request #157 from yangzai/hy-with-error
Refactor Control.Monad.Error.Class.withError.
2 parents 577aecb + 6cde979 commit f3bb5d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Control/Monad/Error/Class.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ tryError action = (Right <$> action) `catchError` (pure . Left)
218218
--
219219
-- @since 2.3
220220
withError :: MonadError e m => (e -> e) -> m a -> m a
221-
withError f action = tryError action >>= either (throwError . f) pure
221+
withError f = handleError (throwError . f)
222222

223223
-- | As 'handle' is flipped 'Control.Exception.catch', 'handleError'
224224
-- is flipped 'catchError'.

0 commit comments

Comments
 (0)