on master help sign in
Flip the arguments order to foldLines and foldWords.
commit5b801ab3352c6dd285b5ab98156de8b6b7ea6502 authorPranay Sashank <pranaysashank@gmail.com> dateWed 7 Aug 2019, 05:21 (7 years ago) parent5d99c94
2 files changed+7−7
benchmark/FileIO.hs+1−1 src/Streamly/String.hs+6−6
benchmark/FileIO.hs+1−1
@@ -131,7 +131,7 @@ main = do
131131 , mkBench "linecount" href $ do
132132 Handles inh _ <- readIORef href
133133 S.length
134− $ flip SS.foldLines FL.drain
134+ $ SS.foldLines FL.drain
135135 $ SS.decodeChar8
136136 $ FH.read inh
137137 , mkBench "sum" href $ do
src/Streamly/String.hs+6−6
@@ -167,20 +167,20 @@ stripStart = S.dropWhile isSpace
167167-- | Fold each line of the stream using the supplied Fold
168168-- and stream the result.
169169--
170−-- >>> S.toList $ foldLines (S.fromList "lines\nthis\nstring\n\n\n") FL.toList
170+-- >>> S.toList $ foldLines FL.toList (S.fromList "lines\nthis\nstring\n\n\n")
171171-- ["lines", "this", "string", "", ""]
172172{-# INLINE foldLines #-}
173−foldLines :: (Monad m, IsStream t) => t m Char -> Fold m Char b -> t m b
174−foldLines = flip (S.splitOnSuffix (== '\n'))
173+foldLines :: (Monad m, IsStream t) => Fold m Char b -> t m Char -> t m b
174+foldLines = S.splitOnSuffix (== '\n')
175175
176176-- | Fold each word of the stream using the supplied Fold
177177-- and stream the result.
178178--
179−-- >>> S.toList $ foldWords (S.fromList "fold these words") FL.toList
179+-- >>> S.toList $ foldWords FL.toList (S.fromList "fold these words")
180180-- ["fold", "these", "words"]
181181{-# INLINE foldWords #-}
182−foldWords :: (Monad m, IsStream t) => t m Char -> Fold m Char b -> t m b
183−foldWords = flip (S.wordsBy isSpace)
182+foldWords :: (Monad m, IsStream t) => Fold m Char b -> t m Char -> t m b
183+foldWords = S.wordsBy isSpace
184184
185185foreign import ccall unsafe "u_iswspace"
186186 iswspace :: Int -> Int