packages feed

conduit 0.5.0 → 0.5.1

raw patch · 3 files changed

+48/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Conduit.List: catMaybes :: Monad m => GInfConduit (Maybe a) m a
+ Data.Conduit.List: mapMaybe :: Monad m => (a -> Maybe b) -> GInfConduit a m b
+ Data.Conduit.List: mapMaybeM :: Monad m => (a -> m (Maybe b)) -> GInfConduit a m b

Files

Data/Conduit/List.hs view
@@ -30,6 +30,8 @@       -- * Conduits       -- ** Pure     , map+    , mapMaybe+    , catMaybes     , concatMap     , concatMapAccum     , groupBy@@ -37,6 +39,7 @@     , filter       -- ** Monadic     , mapM+    , mapMaybeM     , concatMapM     , concatMapAccumM       -- * Misc@@ -206,6 +209,26 @@ -- Since 0.3.0 mapM :: Monad m => (a -> m b) -> GInfConduit a m b mapM f = awaitForever $ yield <=< lift . f++-- | Apply a transformation that may fail to all values in a stream, discarding+-- the failures.+--+-- Since 0.5.1+mapMaybe :: Monad m => (a -> Maybe b) -> GInfConduit a m b+mapMaybe f = awaitForever $ maybe (return ()) yield . f++-- | Apply a monadic transformation that may fail to all values in a stream,+-- discarding the failures.+--+-- Since 0.5.1+mapMaybeM :: Monad m => (a -> m (Maybe b)) -> GInfConduit a m b+mapMaybeM f = awaitForever $ maybe (return ()) yield <=< lift . f++-- | Filter the @Just@ values from a stream, discarding the @Nothing@  values.+--+-- Since 0.5.1+catMaybes :: Monad m => GInfConduit (Maybe a) m a+catMaybes = awaitForever $ maybe (return ()) yield  -- | Apply a transformation to all values in a stream, concatenating the output -- values.
conduit.cabal view
@@ -1,5 +1,5 @@ Name:                conduit-Version:             0.5.0+Version:             0.5.1 Synopsis:            Streaming data processing library. Description:     @conduit@ is a solution to the streaming data problem, allowing for production, transformation, and consumption of streams of data in constant memory. It is an alternative to lazy I\/O which guarantees deterministic resource handling, and fits in the same general solution space as @enumerator@/@iteratee@ and @pipes@. For a brief tutorial, please see the "Data.Conduit" module.
test/main.hs view
@@ -205,6 +205,27 @@                     C.=$ CL.consume             x @?= DL.groupBy (==) input +        it "mapMaybe" $ do+            let input = [Just (1::Int), Nothing, Just 2, Nothing, Just 3]+            x <- runResourceT $ CL.sourceList input+                    C.$$ CL.mapMaybe ((+2) <$>)+                    C.=$ CL.consume+            x @?= [3, 4, 5]++        it "mapMaybeM" $ do+            let input = [Just (1::Int), Nothing, Just 2, Nothing, Just 3]+            x <- runResourceT $ CL.sourceList input+                    C.$$ CL.mapMaybeM (return . ((+2) <$>))+                    C.=$ CL.consume+            x @?= [3, 4, 5]++        it "catMaybes" $ do+            let input = [Just (1::Int), Nothing, Just 2, Nothing, Just 3]+            x <- runResourceT $ CL.sourceList input+                    C.$$ CL.catMaybes+                    C.=$ CL.consume+            x @?= [1, 2, 3]+         it "concatMap" $ do             let input = [1, 11, 21]             x <- runResourceT $ CL.sourceList input@@ -651,9 +672,9 @@     describe "generalizing" $ do         it' "works" $ do             x <-     C.runPipe-                   $ C.sourceToPipe  (CL.sourceList [1..10 :: Int])-               C.>+> C.conduitToPipe (CL.map (+ 1))-               C.>+> C.sinkToPipe    (CL.fold (+) 0)+                   $ CI.sourceToPipe  (CL.sourceList [1..10 :: Int])+               C.>+> CI.conduitToPipe (CL.map (+ 1))+               C.>+> CI.sinkToPipe    (CL.fold (+) 0)             x @?= sum [2..11]      describe "withUpstream" $ do