on master help sign in
Expose catLeft, catRight, catEithers etc.
25ada4eHarendra Kumar
core/src/Streamly/Data/Fold.hs+5−2
@@ -269,14 +269,17 @@ module Streamly.Data.Fold
269 , filterM
269 , filterM
270
270
271 -- -- ** Mapping Filters
271 -- -- ** Mapping Filters
272− , catMaybes
273 , mapMaybe
272 , mapMaybe
273+ , catMaybes
274+ , catLefts
275+ , catRights
276+ , catEithers
274
277
275 -- ** Trimming
278 -- ** Trimming
276 , take
279 , take
277 -- , takeInterval
280 -- , takeInterval
278− , takeEndBy_
279 , takeEndBy
281 , takeEndBy
282+ , takeEndBy_
280
283
281 -- ** Serial Append
284 -- ** Serial Append
282 , splitWith
285 , splitWith
core/src/Streamly/Internal/Data/Fold.hs+1−1
@@ -119,7 +119,7 @@ module Streamly.Internal.Data.Fold
119 -- | Folds that terminate after consuming exactly one input element. All
119 -- | Folds that terminate after consuming exactly one input element. All
120 -- these can be implemented in terms of the 'maybe' fold.
120 -- these can be implemented in terms of the 'maybe' fold.
121 , one
121 , one
122− , null
122+ , null -- XXX not very useful and could be problematic, remove it?
123 , satisfy
123 , satisfy
124 , maybe
124 , maybe
125
125
core/src/Streamly/Internal/Data/Fold/Type.hs+3−1
@@ -905,6 +905,8 @@ data TeeState sL sR bL bR
905--
905--
906-- See also: "Streamly.Data.Fold.Tee"
906-- See also: "Streamly.Data.Fold.Tee"
907--
907--
908+-- Note that nested applications of teeWith do not fuse.
909+--
908{-# INLINE teeWith #-}
910{-# INLINE teeWith #-}
909teeWith :: Monad m => (a -> b -> c) -> Fold m x a -> Fold m x b -> Fold m x c
911teeWith :: Monad m => (a -> b -> c) -> Fold m x a -> Fold m x b -> Fold m x c
910teeWith f (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
912teeWith f (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
@@ -1320,7 +1322,7 @@ catRights = filter isRight . lmap (fromRight undefined)
1320--
1322--
1321-- Definition:
1323-- Definition:
1322--
1324--
1323−-- >>> both = Fold.lmap (either id id)
1325+-- >>> catEithers = Fold.lmap (either id id)
1324--
1326--
1325-- /Pre-release/
1327-- /Pre-release/
1326--
1328--