on master help sign in
Add doc for breakOn
commit5f6fb0af4d3b6f55dd253e416ae5508c3105a312 authorHarendra Kumar <harendra.kumar@gmail.com> dateThu 23 May 2019, 19:26 (7 years ago) parent4211fe2
1 file changed+10
src/Streamly/Fold.hs+10
src/Streamly/Fold.hs+10
@@ -1325,6 +1325,16 @@ groups = groupsBy (==)
13251325------------------------------------------------------------------------------
13261326
13271327{-
1328+-- | Find the first occurrence of the specified sequence in the input stream
1329+-- and break the input stream into two parts, the first part consisting of the
1330+-- stream before the sequence and the second part consisting of the sequence
1331+-- and the rest of the stream.
1332+--
1333+-- > let breakOn_ pat xs = FL.foldl' (FL.breakOn pat FL.toList FL.toList) $ S.fromList xs
1334+--
1335+-- >>> breakOn_ "dear" "Hello dear world!"
1336+-- > ("Hello ","dear world!")
1337+--
13281338{-# INLINE breakOn #-}
13291339breakOn :: Monad m => Array a -> Fold m a b -> Fold m a c -> Fold m a (b,c)
13301340breakOn pat f m = undefined