oops 0.1.1.0 → 0.1.2.0
raw patch · 3 files changed
+13/−3 lines, 3 files
Files
- oops.cabal +3/−3
- src/Control/Monad/Oops.hs +9/−0
- src/Control/Monad/Oops/Classic.hs +1/−0
oops.cabal view
@@ -1,14 +1,14 @@ cabal-version: 3.0 name: oops-version: 0.1.1.0+version: 0.1.2.0 synopsis: Combinators for handling errors of many types in a composable way description: Combinators for handling errors of many types in a composable way. homepage: https://www.github.com/haskell-works/oops license: MIT license-file: LICENSE-author: Tom Harding-maintainer: tomjharding@live.co.uk+author: John Ky+maintainer: newhoggy@gmail.com copyright: 2023 John Ky 2019 Tom Harding category: Data
src/Control/Monad/Oops.hs view
@@ -32,6 +32,7 @@ runOops, suspendM, + catchAsLeftM, catchAndExitFailureM, throwLeftM,@@ -159,6 +160,14 @@ -> ExceptT x m a -> ExceptT x n b suspendM f = ExceptT . f . runExceptT++-- | Catch the specified exception and return the caught value as 'Left'. If no+-- value was caught, then return the returned value in 'Right'.+catchAsLeftM :: forall x e m a. ()+ => Monad m+ => ExceptT (Variant (x : e)) m a+ -> ExceptT (Variant e) m (Either x a)+catchAsLeftM = catchM @x (pure . Left) . fmap Right -- | Catch the specified exception. If that exception is caught, exit the program. catchAndExitFailureM :: forall x e m a. ()
src/Control/Monad/Oops/Classic.hs view
@@ -33,6 +33,7 @@ Oops.runOops, Oops.suspendM, + Oops.catchAsLeftM, Oops.catchAndExitFailureM, Oops.throwLeftM,