@@ -303,6 +303,17 @@ import qualified Streamly.Internal.Data.Stream.StreamD as S
304import Prelude hiding (zipWith, concatMap, concat)
304import Prelude hiding (zipWith, concatMap, concat)
308+-- >>> import Prelude hiding (zipWith, concatMap, concat)
309+-- >>> import qualified Streamly.Prelude as Stream
310+-- >>> import Streamly.Internal.Data.Stream.IsStream as Stream
311+-- >>> import qualified Streamly.Data.Fold as Fold
312+-- >>> import qualified Streamly.Internal.Data.Fold as Fold
313+-- >>> import qualified Streamly.Internal.Data.Unfold as Unfold
314+-- >>> import qualified Streamly.Internal.Data.Parser as Parser
315+-- >>> import qualified Streamly.Data.Array.Foreign as Array
306-------------------------------------------------------------------------------
317-------------------------------------------------------------------------------
307-- Appending
318-- Appending
308-------------------------------------------------------------------------------
319-------------------------------------------------------------------------------
@@ -339,9 +350,10 @@ append m1 m2 = fromStreamD $ D.append (toStreamD m1) (toStreamD m2)
339-- early the other stream continues alone until it too finishes.
350-- early the other stream continues alone until it too finishes.
341-- >>> :set -XOverloadedStrings
352-- >>> :set -XOverloadedStrings
353+-- >>> import Data.Functor.Identity (Identity)
342−-- >>> interleave "ab" ",,,," :: SerialT Identity Char
354+-- >>> Stream.interleave "ab" ",,,," :: Stream.SerialT Identity Char
343-- fromList "a,b,,,"
355-- fromList "a,b,,,"
344−-- >>> interleave "abcd" ",," :: SerialT Identity Char
356+-- >>> Stream.interleave "abcd" ",," :: Stream.SerialT Identity Char
345-- fromList "a,b,cd"
357-- fromList "a,b,cd"
347-- 'interleave' is dual to 'interleaveMin', it can be called @interleaveMax@.
359-- 'interleave' is dual to 'interleaveMin', it can be called @interleaveMax@.
@@ -361,9 +373,10 @@ interleave m1 m2 = fromStreamD $ D.interleave (toStreamD m1) (toStreamD m2)
361-- still continues to yield elements until it finishes.
373-- still continues to yield elements until it finishes.
363-- >>> :set -XOverloadedStrings
375-- >>> :set -XOverloadedStrings
376+-- >>> import Data.Functor.Identity (Identity)
364−-- >>> interleaveSuffix "abc" ",,,," :: SerialT Identity Char
377+-- >>> Stream.interleaveSuffix "abc" ",,,," :: Stream.SerialT Identity Char
365-- fromList "a,b,c,"
378-- fromList "a,b,c,"
366−-- >>> interleaveSuffix "abc" "," :: SerialT Identity Char
379+-- >>> Stream.interleaveSuffix "abc" "," :: Stream.SerialT Identity Char
367-- fromList "a,bc"
380-- fromList "a,bc"
369-- 'interleaveSuffix' is a dual of 'interleaveInfix'.
382-- 'interleaveSuffix' is a dual of 'interleaveInfix'.
@@ -384,9 +397,10 @@ interleaveSuffix m1 m2 =
384-- has finished.
397-- has finished.
386-- >>> :set -XOverloadedStrings
399-- >>> :set -XOverloadedStrings
400+-- >>> import Data.Functor.Identity (Identity)
387−-- >>> interleaveInfix "abc" ",,,," :: SerialT Identity Char
401+-- >>> Stream.interleaveInfix "abc" ",,,," :: Stream.SerialT Identity Char
388-- fromList "a,b,c"
402-- fromList "a,b,c"
389−-- >>> interleaveInfix "abc" "," :: SerialT Identity Char
403+-- >>> Stream.interleaveInfix "abc" "," :: Stream.SerialT Identity Char
390-- fromList "a,bc"
404-- fromList "a,bc"
392-- 'interleaveInfix' is a dual of 'interleaveSuffix'.
406-- 'interleaveInfix' is a dual of 'interleaveSuffix'.
@@ -406,9 +420,10 @@ interleaveInfix m1 m2 =
406-- stream.
420-- stream.
408-- >>> :set -XOverloadedStrings
422-- >>> :set -XOverloadedStrings
423+-- >>> import Data.Functor.Identity (Identity)
409−-- >>> interleaveMin "ab" ",,,," :: SerialT Identity Char
424+-- >>> Stream.interleaveMin "ab" ",,,," :: Stream.SerialT Identity Char
410-- fromList "a,b,"
425-- fromList "a,b,"
411−-- >>> interleaveMin "abcd" ",," :: SerialT Identity Char
426+-- >>> Stream.interleaveMin "abcd" ",," :: Stream.SerialT Identity Char
412-- fromList "a,b,c"
427-- fromList "a,b,c"
414-- 'interleaveMin' is dual to 'interleave'.
429-- 'interleaveMin' is dual to 'interleave'.
@@ -453,8 +468,9 @@ roundrobin m1 m2 = fromStreamD $ D.roundRobin (toStreamD m1) (toStreamD m2)
453-- also remain sorted in ascending order.
468-- also remain sorted in ascending order.
456−-- > S.toList $ S.mergeBy compare (S.fromList [1,3,5]) (S.fromList [2,4,6,8])
471+-- >>> Stream.toList $ Stream.mergeBy compare (Stream.fromList [1,3,5]) (Stream.fromList [2,4,6,8])
457-- [1,2,3,4,5,6,8]
472-- [1,2,3,4,5,6,8]
460-- @since 0.6.0
476-- @since 0.6.0
@@ -763,10 +779,10 @@ gintercalate unf1 str1 unf2 str2 =
764-- | 'intersperse' followed by unfold and concat.
780-- | 'intersperse' followed by unfold and concat.
766−-- > unwords = intercalate " " UF.fromList
782+-- > unwords = intercalate " " Unfold.fromList
768−-- >>> intercalate " " UF.fromList ["abc", "def", "ghi"]
784+-- >>> Stream.toList $ Stream.intercalate " " Unfold.fromList $ Stream.fromList ["abc", "def", "ghi"]
769−-- > "abc def ghi"
785+-- "abc def ghi"
771-- /Internal/
787-- /Internal/
772{-# INLINE intercalate #-}
788{-# INLINE intercalate #-}
@@ -792,10 +808,10 @@ gintercalateSuffix unf1 str1 unf2 str2 =
793-- | 'intersperseSuffix' followed by unfold and concat.
809-- | 'intersperseSuffix' followed by unfold and concat.
795−-- > unlines = intercalateSuffix "\n" UF.fromList
811+-- > unlines = intercalateSuffix "\n" Unfold.fromList
797−-- >>> intercalate "\n" UF.fromList ["abc", "def", "ghi"]
813+-- >>> Stream.toList $ Stream.intercalateSuffix "\n" Unfold.fromList $ Stream.fromList ["abc", "def", "ghi"]
798−-- > "abc\ndef\nghi\n"
814+-- "abc\ndef\nghi\n"
800-- /Internal/
816-- /Internal/
801{-# INLINE intercalateSuffix #-}
817{-# INLINE intercalateSuffix #-}
@@ -932,11 +948,11 @@ iterateMapLeftsWith combine f = iterateMapWith combine (either f (const K.nil))
933-- >>> f = Fold.takeLE 2 Fold.sum
949-- >>> f = Fold.takeLE 2 Fold.sum
934-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList []
950-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList []
936-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList [1..9]
952-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList [1..9]
937−-- > [3,7,11,15,9]
953+-- [3,7,11,15,9]
938-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList [1..10]
954-- >>> Stream.toList $ Stream.foldManyPost f $ Stream.fromList [1..10]
939−-- > [3,7,11,15,19,0]
955+-- [3,7,11,15,19,0]
941-- /Internal/
957-- /Internal/
@@ -955,12 +971,12 @@ foldManyPost f m = D.fromStreamD $ D.foldManyPost f (D.toStreamD m)
956-- >>> f = Fold.takeLE 2 Fold.sum
972-- >>> f = Fold.takeLE 2 Fold.sum
957-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList [1..10]
973-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList [1..10]
958−-- > [3,7,11,15,19]
974+-- [3,7,11,15,19]
960-- On an empty stream the output is empty:
976-- On an empty stream the output is empty:
962-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList []
978-- >>> Stream.toList $ Stream.foldMany f $ Stream.fromList []
965-- Note @foldMany (takeLE 0)@ would result in an infinite loop in a non-empty
981-- Note @foldMany (takeLE 0)@ would result in an infinite loop in a non-empty
966-- stream.
982-- stream.
@@ -992,10 +1008,14 @@ foldSequence _f _m = undefined
992-- generate the first fold, the fold is applied on the stream and the result of
1008-- generate the first fold, the fold is applied on the stream and the result of
993-- the fold is used to generate the next fold and so on.
1009-- the fold is used to generate the next fold and so on.
1012+-- > import Data.Monoid (Sum(..))
995−-- >>> f x = Fold.takeLE 2 (Fold.mconcatTo x)
1013+-- > f x = Fold.takeLE 2 (Fold.sconcat x)
996−-- >>> s = Stream.map Sum $ Stream.fromList [1..10]
1014+-- > s = Stream.map Sum $ Stream.fromList [1..10]
997−-- >>> Stream.toList $ Stream.map getSum $ Stream.foldIterate f 0 s
1015+-- > Stream.toList $ Stream.map getSum $ Stream.foldIterate f 0 s
998−-- > [3,10,21,36,55,55]
1016+-- [3,10,21,36,55,55]
1000-- This is the streaming equivalent of monad like sequenced application of
1020-- This is the streaming equivalent of monad like sequenced application of
1001-- folds where next fold is dependent on the previous fold.
1021-- folds where next fold is dependent on the previous fold.
@@ -1022,11 +1042,14 @@ foldIterate _f _i _m = undefined
1022-- This is the streaming equivalent of the 'Streamly.Internal.Data.Parser.many'
1042-- This is the streaming equivalent of the 'Streamly.Internal.Data.Parser.many'
1023-- parse combinator.
1043-- parse combinator.
1025−-- >>> S.toList $ S.parseMany (PR.take 2 $ PR.fromFold FL.sum) $ S.fromList [1..10]
1045+-- >>> Stream.toList $ Stream.parseMany (Parser.takeBetween 0 2 Fold.sum) $ Stream.fromList [1..10]
1026−-- > [3,7,11,15,19]
1046+-- [3,7,11,15,19]
1049+-- > Stream.toList $ Stream.parseMany (Parser.line Fold.toList) $ Stream.fromList "hello\\nworld"
1050+-- ["hello\\n","world"]
1028−-- >>> S.toList $ S.parseMany (PR.line FL.toList) $ S.fromList "hello\nworld"
1052+-- @
1029−-- > ["hello\n","world"]
1032-- foldMany f = parseMany (fromFold f)
1055-- foldMany f = parseMany (fromFold f)
@@ -1089,8 +1112,9 @@ parseManyTill = undefined
1089-- used to generate the first parser, the parser is applied on the stream and
1112-- used to generate the first parser, the parser is applied on the stream and
1090-- the result is used to generate the next parser and so on.
1113-- the result is used to generate the next parser and so on.
1115+-- >>> import Data.Monoid (Sum(..))
1092−-- >>> S.toList $ S.map getSum $ S.parseIterate (\b -> PR.take 2 (FL.mconcatTo b)) 0 $ S.map Sum $ S.fromList [1..10]
1116+-- >>> Stream.toList $ Stream.map getSum $ Stream.parseIterate (\b -> Parser.takeBetween 0 2 (Fold.sconcat b)) 0 $ Stream.map Sum $ Stream.fromList [1..10]
1093−-- > [3,10,21,36,55,55]
1117+-- [3,10,21,36,55,55]
1095-- This is the streaming equivalent of monad like sequenced application of
1119-- This is the streaming equivalent of monad like sequenced application of
1096-- parsers where next parser is dependent on the previous parser.
1120-- parsers where next parser is dependent on the previous parser.
@@ -1196,8 +1220,8 @@ groupScan split fold m = undefined
1196-- group is folded using the fold @f@ and the result of the fold is emitted in
1220-- group is folded using the fold @f@ and the result of the fold is emitted in
1197-- the output stream.
1221-- the output stream.
1199−-- >>> S.toList $ S.groupsBy (>) FL.toList $ S.fromList [1,3,7,0,2,5]
1223+-- >>> Stream.toList $ Stream.groupsBy (>) Fold.toList $ Stream.fromList [1,3,7,0,2,5]
1200−-- > [[1,3,7],[0,2,5]]
1224+-- [[1,3,7],[0,2,5]]
1202-- @since 0.7.0
1226-- @since 0.7.0
1203{-# INLINE groupsBy #-}
1227{-# INLINE groupsBy #-}
@@ -1217,8 +1241,8 @@ groupsBy cmp f m = D.fromStreamD $ D.groupsBy cmp f (D.toStreamD m)
1217-- comparison fails a new group is started. Each group is folded using the fold
1241-- comparison fails a new group is started. Each group is folded using the fold
1220−-- >>> S.toList $ S.groupsByRolling (\a b -> a + 1 == b) FL.toList $ S.fromList [1,2,3,7,8,9]
1244+-- >>> Stream.toList $ Stream.groupsByRolling (\a b -> a + 1 == b) Fold.toList $ Stream.fromList [1,2,3,7,8,9]
1221−-- > [[1,2,3],[7,8,9]]
1245+-- [[1,2,3],[7,8,9]]
1223-- @since 0.7.0
1247-- @since 0.7.0
1224{-# INLINE groupsByRolling #-}
1248{-# INLINE groupsByRolling #-}
@@ -1236,8 +1260,8 @@ groupsByRolling cmp f m = D.fromStreamD $ D.groupsRollingBy cmp f (D.toStreamD
1237-- Groups contiguous spans of equal elements together in individual groups.
1261-- Groups contiguous spans of equal elements together in individual groups.
1239−-- >>> S.toList $ S.groups FL.toList $ S.fromList [1,1,2,2]
1263+-- >>> Stream.toList $ Stream.groups Fold.toList $ Stream.fromList [1,1,2,2]
1240−-- > [[1,1],[2,2]]
1264+-- [[1,1],[2,2]]
1242-- @since 0.7.0
1266-- @since 0.7.0
1243{-# INLINE groups #-}
1267{-# INLINE groups #-}
@@ -1262,9 +1286,9 @@ groups = groupsBy (==)
1262-- separator elements determined by the supplied predicate, separator is
1286-- separator elements determined by the supplied predicate, separator is
1263-- considered as infixed between two segments:
1287-- considered as infixed between two segments:
1265−-- >>> splitOn' p xs = S.toList $ S.splitOn p FL.toList (S.fromList xs)
1289+-- >>> splitOn' p xs = Stream.toList $ Stream.splitOn p Fold.toList (Stream.fromList xs)
1266-- >>> splitOn' (== '.') "a.b"
1290-- >>> splitOn' (== '.') "a.b"
1267−-- > ["a","b"]
1291+-- ["a","b"]
1269-- An empty stream is folded to the default value of the fold:
1293-- An empty stream is folded to the default value of the fold:
@@ -1278,13 +1302,13 @@ groups = groupsBy (==)
1278-- ["",""]
1302-- ["",""]
1280-- >>> splitOn' (== '.') ".a"
1304-- >>> splitOn' (== '.') ".a"
1281−-- > ["","a"]
1305+-- ["","a"]
1283-- >>> splitOn' (== '.') "a."
1307-- >>> splitOn' (== '.') "a."
1284−-- > ["a",""]
1308+-- ["a",""]
1286-- >>> splitOn' (== '.') "a..b"
1310-- >>> splitOn' (== '.') "a..b"
1287−-- > ["a","","b"]
1311+-- ["a","","b"]
1289-- splitOn is an inverse of intercalating single element:
1313-- splitOn is an inverse of intercalating single element:
@@ -1318,12 +1342,12 @@ splitOn predicate f =
1318-- | Split on a suffixed separator element, dropping the separator. The
1342-- | Split on a suffixed separator element, dropping the separator. The
1319-- supplied 'Fold' is applied on the split segments.
1343-- supplied 'Fold' is applied on the split segments.
1321−-- > splitOnSuffix' p xs = S.toList $ S.splitOnSuffix p (FL.toList) (S.fromList xs)
1345+-- >>> splitOnSuffix' p xs = Stream.toList $ Stream.splitOnSuffix p Fold.toList (Stream.fromList xs)
1322-- >>> splitOnSuffix' (== '.') "a.b."
1346-- >>> splitOnSuffix' (== '.') "a.b."
1323−-- > ["a","b"]
1347+-- ["a","b"]
1325-- >>> splitOnSuffix' (== '.') "a."
1349-- >>> splitOnSuffix' (== '.') "a."
1326−-- > ["a"]
1350+-- ["a"]
1328-- An empty stream results in an empty output stream:
1352-- An empty stream results in an empty output stream:
@@ -1337,7 +1361,7 @@ splitOn predicate f =
1339-- >>> splitOnSuffix' (== '.') "a..b.."
1363-- >>> splitOnSuffix' (== '.') "a..b.."
1340−-- > ["a","","b",""]
1364+-- ["a","","b",""]
1342-- A suffix is optional at the end of the stream:
1366-- A suffix is optional at the end of the stream:
@@ -1345,10 +1369,10 @@ splitOn predicate f =
1347-- >>> splitOnSuffix' (== '.') ".a"
1371-- >>> splitOnSuffix' (== '.') ".a"
1348−-- > ["","a"]
1372+-- ["","a"]
1350-- >>> splitOnSuffix' (== '.') "a.b"
1374-- >>> splitOnSuffix' (== '.') "a.b"
1351−-- > ["a","b"]
1375+-- ["a","b"]
1353-- > lines = splitOnSuffix (== '\n')
1377-- > lines = splitOnSuffix (== '\n')
@@ -1371,33 +1395,42 @@ splitOnSuffix predicate f = foldMany (FL.sliceSepBy predicate f)
1371-- | Split on a prefixed separator element, dropping the separator. The
1395-- | Split on a prefixed separator element, dropping the separator. The
1372-- supplied 'Fold' is applied on the split segments.
1396-- supplied 'Fold' is applied on the split segments.
1374−-- >>> splitOnPrefix' p xs = S.toList $ S.splitOnPrefix p (FL.toList) (S.fromList xs)
1399+-- > splitOnPrefix' p xs = Stream.toList $ Stream.splitOnPrefix p (Fold.toList) (Stream.fromList xs)
1375−-- >>> splitOnPrefix' (== '.') ".a.b"
1400+-- > splitOnPrefix' (== '.') ".a.b"
1376−-- > ["a","b"]
1401+-- ["a","b"]
1378-- An empty stream results in an empty output stream:
1404-- An empty stream results in an empty output stream:
1379−-- >>> splitOnPrefix' (== '.') ""
1406+-- > splitOnPrefix' (== '.') ""
1382-- An empty segment consisting of only a prefix is folded to the default output
1410-- An empty segment consisting of only a prefix is folded to the default output
1383-- of the fold:
1411-- of the fold:
1385−-- >>> splitOnPrefix' (== '.') "."
1414+-- > splitOnPrefix' (== '.') "."
1388−-- >>> splitOnPrefix' (== '.') ".a.b."
1417+-- > splitOnPrefix' (== '.') ".a.b."
1420+-- > splitOnPrefix' (== '.') ".a..b"
1389−-- > ["a","b",""]
1421+-- ["a","","b"]
1391−-- >>> splitOnPrefix' (== '.') ".a..b"
1423+-- @
1394-- A prefix is optional at the beginning of the stream:
1425-- A prefix is optional at the beginning of the stream:
1396−-- >>> splitOnPrefix' (== '.') "a"
1428+-- > splitOnPrefix' (== '.') "a"
1399−-- >>> splitOnPrefix' (== '.') "a.b"
1431+-- > splitOnPrefix' (== '.') "a.b"
1400−-- > ["a","b"]
1432+-- ["a","b"]
1402-- 'splitOnPrefix' is an inverse of 'intercalatePrefix' with a single element:
1435-- 'splitOnPrefix' is an inverse of 'intercalatePrefix' with a single element:
@@ -1420,16 +1453,16 @@ splitOnPrefix _predicate _f = undefined
1420-- @["a","b"]@. In other words, its like parsing words from whitespace
1453-- @["a","b"]@. In other words, its like parsing words from whitespace
1421-- separated text.
1454-- separated text.
1423−-- > wordsBy' p xs = S.toList $ S.wordsBy p (FL.toList) (S.fromList xs)
1456+-- >>> wordsBy' p xs = Stream.toList $ Stream.wordsBy p Fold.toList (Stream.fromList xs)
1425-- >>> wordsBy' (== ',') ""
1458-- >>> wordsBy' (== ',') ""
1428-- >>> wordsBy' (== ',') ","
1461-- >>> wordsBy' (== ',') ","
1431-- >>> wordsBy' (== ',') ",a,,b,"
1464-- >>> wordsBy' (== ',') ",a,,b,"
1432−-- > ["a","b"]
1465+-- ["a","b"]
1434-- > words = wordsBy isSpace
1467-- > words = wordsBy isSpace
@@ -1447,7 +1480,7 @@ wordsBy predicate f m =
1447-- | Like 'splitOnSuffix' but keeps the suffix attached to the resulting
1480-- | Like 'splitOnSuffix' but keeps the suffix attached to the resulting
1448-- splits.
1481-- splits.
1450−-- > splitWithSuffix' p xs = S.toList $ S.splitWithSuffix p (FL.toList) (S.fromList xs)
1483+-- >>> splitWithSuffix' p xs = Stream.toList $ splitWithSuffix p Fold.toList (Stream.fromList xs)
1452-- >>> splitWithSuffix' (== '.') ""
1485-- >>> splitWithSuffix' (== '.') ""
@@ -1459,19 +1492,19 @@ wordsBy predicate f m =
1461-- >>> splitWithSuffix' (== '.') ".a"
1494-- >>> splitWithSuffix' (== '.') ".a"
1462−-- > [".","a"]
1495+-- [".","a"]
1464-- >>> splitWithSuffix' (== '.') "a."
1497-- >>> splitWithSuffix' (== '.') "a."
1465−-- > ["a."]
1498+-- ["a."]
1467-- >>> splitWithSuffix' (== '.') "a.b"
1500-- >>> splitWithSuffix' (== '.') "a.b"
1468−-- > ["a.","b"]
1501+-- ["a.","b"]
1470-- >>> splitWithSuffix' (== '.') "a.b."
1503-- >>> splitWithSuffix' (== '.') "a.b."
1471−-- > ["a.","b."]
1504+-- ["a.","b."]
1473-- >>> splitWithSuffix' (== '.') "a..b.."
1506-- >>> splitWithSuffix' (== '.') "a..b.."
1474−-- > ["a.",".","b.","."]
1507+-- ["a.",".","b.","."]
1476-- @since 0.7.0
1509-- @since 0.7.0
@@ -1529,34 +1562,34 @@ splitOnAny subseq f m = undefined -- D.fromStreamD $ D.splitOnAny f subseq (D.to
1530-- | Like 'splitOnSeq' but splits the separator as well, as an infix token.
1563-- | Like 'splitOnSeq' but splits the separator as well, as an infix token.
1532−-- > splitOn'_ pat xs = S.toList $ S.splitOn' (A.fromList pat) (FL.toList) (S.fromList xs)
1565+-- >>> splitOn'_ pat xs = Stream.toList $ Stream.splitBySeq (Array.fromList pat) Fold.toList (Stream.fromList xs)
1534-- >>> splitOn'_ "" "hello"
1567-- >>> splitOn'_ "" "hello"
1535−-- > ["h","","e","","l","","l","","o"]
1568+-- ["h","","e","","l","","l","","o"]
1537-- >>> splitOn'_ "hello" ""
1570-- >>> splitOn'_ "hello" ""
1538−-- > [""]
1571+-- [""]
1540-- >>> splitOn'_ "hello" "hello"
1573-- >>> splitOn'_ "hello" "hello"
1541−-- > ["","hello",""]
1574+-- ["","hello",""]
1543-- >>> splitOn'_ "x" "hello"
1576-- >>> splitOn'_ "x" "hello"
1544−-- > ["hello"]
1577+-- ["hello"]
1546-- >>> splitOn'_ "h" "hello"
1579-- >>> splitOn'_ "h" "hello"
1547−-- > ["","h","ello"]
1580+-- ["","h","ello"]
1549-- >>> splitOn'_ "o" "hello"
1582-- >>> splitOn'_ "o" "hello"
1550−-- > ["hell","o",""]
1583+-- ["hell","o",""]
1552-- >>> splitOn'_ "e" "hello"
1585-- >>> splitOn'_ "e" "hello"
1553−-- > ["h","e","llo"]
1586+-- ["h","e","llo"]
1555-- >>> splitOn'_ "l" "hello"
1588-- >>> splitOn'_ "l" "hello"
1556−-- > ["he","l","","l","o"]
1589+-- ["he","l","","l","o"]
1558-- >>> splitOn'_ "ll" "hello"
1591-- >>> splitOn'_ "ll" "hello"
1559−-- > ["he","ll","o"]
1592+-- ["he","ll","o"]
1561-- /Internal/
1594-- /Internal/
1562{-# INLINE splitBySeq #-}
1595{-# INLINE splitBySeq #-}
@@ -1569,7 +1602,7 @@ splitBySeq patt f m =
1569-- | Like 'splitSuffixBy' but the separator is a sequence of elements, instead
1602-- | Like 'splitSuffixBy' but the separator is a sequence of elements, instead
1570-- of a predicate for a single element.
1603-- of a predicate for a single element.
1572−-- > splitOnSuffixSeq_ pat xs = S.toList $ S.splitOnSuffixSeq (A.fromList pat) (FL.toList) (S.fromList xs)
1605+-- >>> splitOnSuffixSeq_ pat xs = Stream.toList $ Stream.splitOnSuffixSeq (Array.fromList pat) Fold.toList (Stream.fromList xs)
1574-- >>> splitOnSuffixSeq_ "." ""
1607-- >>> splitOnSuffixSeq_ "." ""
@@ -1581,19 +1614,19 @@ splitBySeq patt f m =
1583-- >>> splitOnSuffixSeq_ "." ".a"
1616-- >>> splitOnSuffixSeq_ "." ".a"
1584−-- > ["","a"]
1617+-- ["","a"]
1586-- >>> splitOnSuffixSeq_ "." "a."
1619-- >>> splitOnSuffixSeq_ "." "a."
1587−-- > ["a"]
1620+-- ["a"]
1589-- >>> splitOnSuffixSeq_ "." "a.b"
1622-- >>> splitOnSuffixSeq_ "." "a.b"
1590−-- > ["a","b"]
1623+-- ["a","b"]
1592-- >>> splitOnSuffixSeq_ "." "a.b."
1625-- >>> splitOnSuffixSeq_ "." "a.b."
1593−-- > ["a","b"]
1626+-- ["a","b"]
1595-- >>> splitOnSuffixSeq_ "." "a..b.."
1628-- >>> splitOnSuffixSeq_ "." "a..b.."
1596−-- > ["a","","b",""]
1629+-- ["a","","b",""]
1598-- > lines = splitOnSuffixSeq "\n"
1631-- > lines = splitOnSuffixSeq "\n"
@@ -1627,10 +1660,10 @@ wordsOn subseq f m = undefined -- D.fromStreamD $ D.wordsOn f subseq (D.toStream
1628-- | Like 'splitOnSuffixSeq' but keeps the suffix intact in the splits.
1661-- | Like 'splitOnSuffixSeq' but keeps the suffix intact in the splits.
1630−-- > splitWithSuffixSeq'_ pat xs = S.toList $ S.splitWithSuffixSeq (A.fromList pat) (FL.toList) (S.fromList xs)
1663+-- >>> splitWithSuffixSeq' pat xs = Stream.toList $ Stream.splitWithSuffixSeq (Array.fromList pat) Fold.toList (Stream.fromList xs)
1632-- >>> splitWithSuffixSeq' "." ""
1665-- >>> splitWithSuffixSeq' "." ""
1635-- >>> splitWithSuffixSeq' "." "."
1668-- >>> splitWithSuffixSeq' "." "."
@@ -1639,19 +1672,19 @@ wordsOn subseq f m = undefined -- D.fromStreamD $ D.wordsOn f subseq (D.toStream
1641-- >>> splitWithSuffixSeq' "." ".a"
1674-- >>> splitWithSuffixSeq' "." ".a"
1642−-- > [".","a"]
1675+-- [".","a"]
1644-- >>> splitWithSuffixSeq' "." "a."
1677-- >>> splitWithSuffixSeq' "." "a."
1645−-- > ["a."]
1678+-- ["a."]
1647-- >>> splitWithSuffixSeq' "." "a.b"
1680-- >>> splitWithSuffixSeq' "." "a.b"
1648−-- > ["a.","b"]
1681+-- ["a.","b"]
1650-- >>> splitWithSuffixSeq' "." "a.b."
1683-- >>> splitWithSuffixSeq' "." "a.b."
1651−-- > ["a.","b."]
1684+-- ["a.","b."]
1653-- >>> splitWithSuffixSeq' "." "a..b.."
1686-- >>> splitWithSuffixSeq' "." "a..b.."
1654−-- > ["a.",".","b.","."]
1687+-- ["a.",".","b.","."]
1656-- /Internal/
1689-- /Internal/
1657{-# INLINE splitWithSuffixSeq #-}
1690{-# INLINE splitWithSuffixSeq #-}
@@ -1679,8 +1712,8 @@ splitOnSuffixSeqAny subseq f m = undefined
1679-- | Group the input stream into groups of @n@ elements each and then fold each
1712-- | Group the input stream into groups of @n@ elements each and then fold each
1680-- group using the provided fold function.
1713-- group using the provided fold function.
1682−-- >> S.toList $ S.chunksOf 2 FL.sum (S.enumerateFromTo 1 10)
1715+-- >>> Stream.toList $ Stream.chunksOf 2 Fold.sum (Stream.enumerateFromTo 1 10)
1683−-- > [3,7,11,15,19]
1716+-- [3,7,11,15,19]
1685-- This can be considered as an n-fold version of 'takeLE' where we apply
1718-- This can be considered as an n-fold version of 'takeLE' where we apply
1686-- 'takeLE' repeatedly on the leftover stream until the stream exhausts.
1719-- 'takeLE' repeatedly on the leftover stream until the stream exhausts.
@@ -1718,12 +1751,13 @@ arraysOf n = D.fromStreamD . A.arraysOf n . D.toStreamD
1719-- XXX we can implement this by repeatedly applying the 'lrunFor' fold.
1752-- XXX we can implement this by repeatedly applying the 'lrunFor' fold.
1720-- XXX add this example after fixing the serial stream rate control
1753-- XXX add this example after fixing the serial stream rate control
1721−-- >>> S.toList $ S.take 5 $ intervalsOf 1 FL.sum $ constRate 2 $ S.enumerateFrom 1
1724-- | Group the input stream into windows of @n@ second each and then fold each
1755-- | Group the input stream into windows of @n@ second each and then fold each
1725-- group using the provided fold function.
1756-- group using the provided fold function.
1758+-- >>> Stream.toList $ Stream.take 5 $ Stream.intervalsOf 1 Fold.sum $ Stream.constRate 2 $ Stream.enumerateFrom 1
1759+-- [...,...,...,...,...]
1727-- @since 0.7.0
1761-- @since 0.7.0
1728{-# INLINE intervalsOf #-}
1762{-# INLINE intervalsOf #-}
1729intervalsOf
1763intervalsOf
@@ -2188,12 +2222,18 @@ classifyChunksOf wsize = classifyChunksBy wsize False
2191−-- >>> S.mapM_ print
2226+-- Stream.mapM_ print
2192−-- $ S.classifySessionsOf 3 (const (return False)) (fmap Right FL.toList)
2227+-- $ Stream.classifySessionsOf 3 (const (return False)) (fmap Right Fold.toList)
2193−-- $ S.map (\(ts,(k,a)) -> (k, a, ts))
2228+-- $ Stream.map (\\(ts,(k,a)) -> (k, a, ts))
2194−-- $ S.timestamped
2229+-- $ Stream.timestamped
2195−-- $ S.delay 1
2230+-- $ Stream.delay 1
2196−-- $ (,) <$> S.fromList [1,2,3] <*> S.fromList [1,2,3]
2231+-- $ (,) <$> Stream.fromList [1,2,3] <*> Stream.fromList [1,2,3]
2233+-- (1,Right [1,2,3])
2234+-- (2,Right [1,2,3])
2235+-- (3,Right [1,2,3])
2199-- /Internal/
2239-- /Internal/