on master help sign in
Expose catLeft, catRight, catEithers etc.

And update some minor docs for folds.

commit25ada4ec5fb3fc02ccee6550b103a6b4a03181fd authorHarendra Kumar <harendra@composewell.com> dateMon 26 Dec 2022, 10:05 (4 years ago) parenta866e1f
3 files changed+9−4
core/src/Streamly/Data/Fold.hs+5−2 core/src/Streamly/Internal/Data/Fold.hs+1−1 core/src/Streamly/Internal/Data/Fold/Type.hs+3−1
core/src/Streamly/Data/Fold.hs+5−2
@@ -269,14 +269,17 @@ module Streamly.Data.Fold
269269 , filterM
270270
271271 -- -- ** Mapping Filters
272− , catMaybes
273272 , mapMaybe
273+ , catMaybes
274+ , catLefts
275+ , catRights
276+ , catEithers
274277
275278 -- ** Trimming
276279 , take
277280 -- , takeInterval
278− , takeEndBy_
279281 , takeEndBy
282+ , takeEndBy_
280283
281284 -- ** Serial Append
282285 , splitWith
core/src/Streamly/Internal/Data/Fold.hs+1−1
@@ -119,7 +119,7 @@ module Streamly.Internal.Data.Fold
119119 -- | Folds that terminate after consuming exactly one input element. All
120120 -- these can be implemented in terms of the 'maybe' fold.
121121 , one
122− , null
122+ , null -- XXX not very useful and could be problematic, remove it?
123123 , satisfy
124124 , maybe
125125
core/src/Streamly/Internal/Data/Fold/Type.hs+3−1
@@ -905,6 +905,8 @@ data TeeState sL sR bL bR
905905--
906906-- See also: "Streamly.Data.Fold.Tee"
907907--
908+-- Note that nested applications of teeWith do not fuse.
909+--
908910{-# INLINE teeWith #-}
909911teeWith :: Monad m => (a -> b -> c) -> Fold m x a -> Fold m x b -> Fold m x c
910912teeWith f (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
@@ -1320,7 +1322,7 @@ catRights = filter isRight . lmap (fromRight undefined)
13201322--
13211323-- Definition:
13221324--
1323−-- >>> both = Fold.lmap (either id id)
1325+-- >>> catEithers = Fold.lmap (either id id)
13241326--
13251327-- /Pre-release/
13261328--