oops 0.1.4.0 → 0.1.5.0
raw patch · 2 files changed
+18/−1 lines, 2 files
Files
- oops.cabal +1/−1
- src/Control/Monad/Oops.hs +17/−0
oops.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 name: oops-version: 0.1.4.0+version: 0.1.5.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
src/Control/Monad/Oops.hs view
@@ -46,6 +46,9 @@ throwPureNothingM, throwPureNothingAsM, + leftM,+ nothingM,+ recoverM, recoverOrVoidM, @@ -258,6 +261,20 @@ -> m (Maybe a) -> m a throwPureNothingAsM e f = f >>= throwNothingAsM e++leftM :: forall x m a. ()+ => Monad m+ => (x -> m a)+ -> m (Either x a)+ -> m a+leftM g f = f >>= either g pure++nothingM :: forall m a. ()+ => Monad m+ => m a+ -> m (Maybe a)+ -> m a+nothingM g f = f >>= maybe g pure -- | Catch the specified exception and return it instead. -- The evaluated computation must return the same type that is being caught.