on master help sign in
Flip the arguments order to foldLines and foldWords.
5b801abPranay Sashank
benchmark/FileIO.hs+1−1
@@ -131,7 +131,7 @@ main = do
131 , mkBench "linecount" href $ do
131 , mkBench "linecount" href $ do
132 Handles inh _ <- readIORef href
132 Handles inh _ <- readIORef href
133 S.length
133 S.length
134− $ flip SS.foldLines FL.drain
134+ $ SS.foldLines FL.drain
135 $ SS.decodeChar8
135 $ SS.decodeChar8
136 $ FH.read inh
136 $ FH.read inh
137 , mkBench "sum" href $ do
137 , mkBench "sum" href $ do
src/Streamly/String.hs+6−6
@@ -167,20 +167,20 @@ stripStart = S.dropWhile isSpace
167-- | Fold each line of the stream using the supplied Fold
167-- | Fold each line of the stream using the supplied Fold
168-- and stream the result.
168-- and stream the result.
169--
169--
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")
171-- ["lines", "this", "string", "", ""]
171-- ["lines", "this", "string", "", ""]
172{-# INLINE foldLines #-}
172{-# INLINE foldLines #-}
173−foldLines :: (Monad m, IsStream t) => t m Char -> Fold m Char b -> t m b
173+foldLines :: (Monad m, IsStream t) => Fold m Char b -> t m Char -> t m b
174−foldLines = flip (S.splitOnSuffix (== '\n'))
174+foldLines = S.splitOnSuffix (== '\n')
175
175
176-- | Fold each word of the stream using the supplied Fold
176-- | Fold each word of the stream using the supplied Fold
177-- and stream the result.
177-- and stream the result.
178--
178--
179−-- >>> S.toList $ foldWords (S.fromList "fold these words") FL.toList
179+-- >>> S.toList $ foldWords FL.toList (S.fromList "fold these words")
180-- ["fold", "these", "words"]
180-- ["fold", "these", "words"]
181{-# INLINE foldWords #-}
181{-# INLINE foldWords #-}
182−foldWords :: (Monad m, IsStream t) => t m Char -> Fold m Char b -> t m b
182+foldWords :: (Monad m, IsStream t) => Fold m Char b -> t m Char -> t m b
183−foldWords = flip (S.wordsBy isSpace)
183+foldWords = S.wordsBy isSpace
184
184
185foreign import ccall unsafe "u_iswspace"
185foreign import ccall unsafe "u_iswspace"
186 iswspace :: Int -> Int
186 iswspace :: Int -> Int