extra 1.4.5 → 1.4.6
raw patch · 4 files changed
+15/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Monad.Extra: eitherM :: Monad m => (a -> m c) -> (b -> m c) -> m (Either a b) -> m c
+ Control.Monad.Extra: maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b
+ Extra: eitherM :: Monad m => (a -> m c) -> (b -> m c) -> m (Either a b) -> m c
+ Extra: maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b
Files
- CHANGES.txt +2/−0
- extra.cabal +1/−1
- src/Control/Monad/Extra.hs +11/−0
- src/Extra.hs +1/−1
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for Extra +1.4.6+ #11, add maybeM and eitherM 1.4.5 #17, change fileEq on files that do not exist to be an error 1.4.4
extra.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.10 build-type: Simple name: extra-version: 1.4.5+version: 1.4.6 license: BSD3 license-file: LICENSE category: Development
src/Control/Monad/Extra.hs view
@@ -8,6 +8,7 @@ module Control.Monad, whenJust, whenJustM, unit,+ maybeM, eitherM, -- * Loops loopM, whileM, -- * Lists@@ -41,6 +42,16 @@ -- > \(x :: Maybe ()) -> unit x == x unit :: m () -> m () unit = id+++-- | Monadic generalisation of 'maybe'.+maybeM :: Monad m => m b -> (a -> m b) -> m (Maybe a) -> m b+maybeM n j x = maybe n j =<< x+++-- | Monadic generalisation of 'either'.+eitherM :: Monad m => (a -> m c) -> (b -> m c) -> m (Either a b) -> m c+eitherM l r x = either l r =<< x -- Data.List for Monad
src/Extra.hs view
@@ -14,7 +14,7 @@ retry, retryBool, showException, stringException, errorIO, ignore, catch_, handle_, try_, catchJust_, handleJust_, tryJust_, catchBool, handleBool, tryBool, -- * Control.Monad.Extra -- | Extra functions available in @"Control.Monad.Extra"@.- whenJust, whenJustM, unit, loopM, whileM, partitionM, concatMapM, mconcatMapM, mapMaybeM, findM, firstJustM, whenM, unlessM, ifM, notM, (||^), (&&^), orM, andM, anyM, allM,+ whenJust, whenJustM, unit, maybeM, eitherM, loopM, whileM, partitionM, concatMapM, mconcatMapM, mapMaybeM, findM, firstJustM, whenM, unlessM, ifM, notM, (||^), (&&^), orM, andM, anyM, allM, -- * Data.Either.Extra -- | Extra functions available in @"Data.Either.Extra"@. isLeft, isRight, fromLeft, fromRight, fromEither,