monadplus 1.4.1 → 1.4.2
raw patch · 2 files changed
+19/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Monad.Plus: mconcatMap' :: (MonadPlus m, Foldable t) => (a -> t b) -> m a -> m b
+ Control.Monad.Plus: mreturn :: MonadPlus m => (a -> Maybe b) -> a -> m b
Files
- monadplus.cabal +1/−1
- src/Control/Monad/Plus.hs +18/−7
monadplus.cabal view
@@ -1,6 +1,6 @@ name: monadplus-version: 1.4.1+version: 1.4.2 cabal-version: >= 1.10 author: Hans Hoglund maintainer: Hans Hoglund <hans@hanshoglund.se>
src/Control/Monad/Plus.hs view
@@ -33,6 +33,7 @@ mfold, mfromList, mfromMaybe,+ mreturn, -- * Filtering -- mfilter,@@ -49,6 +50,7 @@ -- * Special maps mmapMaybe, mconcatMap,+ mconcatMap', -- * Utility Partial(..),@@ -99,6 +101,13 @@ mfromMaybe = maybe mzero return -- | +-- Convert a partial function to a function returning an arbitrary+-- 'MonadPlus' type.+-- +mreturn :: MonadPlus m => (a -> Maybe b) -> a -> m b+mreturn f = mfromMaybe . f++-- | -- The 'partition' function takes a predicate a list and returns -- the pair of lists of elements which do and do not satisfy the -- predicate, respectively; i.e.,@@ -181,14 +190,15 @@ mconcatMap :: MonadPlus m => (a -> [b]) -> m a -> m b mconcatMap f = mscatter . liftM f -{--mmapLefts :: MonadPlus m => (a -> Either b c) -> m a -> m b-mmapLefts f = mlefts . liftM f+-- | +-- Modify, discard or spawn values.+-- +-- This function generalizes the 'concatMap' function.+-- +mconcatMap' :: (MonadPlus m, Foldable t) => (a -> t b) -> m a -> m b+mconcatMap' f = mscatter' . liftM f -mmapRights :: MonadPlus m => (a -> Either c b) -> m a -> m b-mmapRights f = mrights . liftM f --} -- | -- Convert a predicate to a partial function.@@ -246,4 +256,5 @@ instance Monoid (Partial a b) where mempty = mzero mappend = mplus- ++