can-i-haz 0.3.0.0 → 0.3.1.0
raw patch · 3 files changed
+15/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Monad.Except.CoHas: liftMaybe :: (MonadError error m, CoHas option error) => option -> Maybe a -> m a
Files
- ChangeLog.md +4/−0
- can-i-haz.cabal +3/−3
- src/Control/Monad/Except/CoHas.hs +8/−0
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for can-i-haz +## 0.3.1.0++* Add `liftMaybe` utility function to `Control.Monad.Except.CoHas`.+ ## 0.3.0.0 * Reexport `Control.Monad.Reader` from the `Control.Monad.Reader.Has` module with
can-i-haz.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.0.+-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: c910611bf208cea23fae88a3630f1682ec77f54fcef2a2aed6b14ef41a12904c+-- hash: af1810287bc5b23d221bbd0e94f0e0c3016a9c1269cf8169b84688faebfa71e5 name: can-i-haz-version: 0.3.0.0+version: 0.3.1.0 synopsis: Generic implementation of the Has and CoHas patterns description: Please see the README on GitHub at <https://github.com/0xd34df00d/can-i-haz#readme> category: Control
src/Control/Monad/Except/CoHas.hs view
@@ -84,6 +84,7 @@ , module X , throwError , liftEither+, liftMaybe ) where import qualified Control.Monad.Except as M@@ -152,3 +153,10 @@ -- with the type adjusted for better compatibility with 'CoHas'. liftEither :: (MonadError error m, CoHas option error) => Either option a -> m a liftEither = M.liftEither . first inject++-- | Lifts a 'Maybe' into any 'MonadError' @error@.+--+-- This function 'inject's the passed @option@ if the 'Maybe' is 'Nothing'.+liftMaybe :: (MonadError error m, CoHas option error) => option -> Maybe a -> m a+liftMaybe _ (Just val) = pure val+liftMaybe err Nothing = throwError err