on master help sign in
rename unlinesBy to concatWithSuffix
fb39bc3Harendra Kumar
src/Streamly/Data/String.hs+3−3
@@ -250,14 +250,14 @@ words = foldWords A.write
250-- >>> S.toList $ unlines $ S.fromList ["lines", "this", "string"]
250-- >>> S.toList $ unlines $ S.fromList ["lines", "this", "string"]
251-- "lines\nthis\nstring\n"
251-- "lines\nthis\nstring\n"
252--
252--
253−-- > unlines = AS.unlinesBy '\n'
253+-- > unlines = A.concatWithSuffix '\n'
254--
254--
255-- Note that, in general
255-- Note that, in general
256--
256--
257-- > unlines . lines /= id
257-- > unlines . lines /= id
258{-# INLINE unlines #-}
258{-# INLINE unlines #-}
259unlines :: (MonadIO m, IsStream t) => t m (Array Char) -> t m Char
259unlines :: (MonadIO m, IsStream t) => t m (Array Char) -> t m Char
260−unlines = AS.unlinesBy '\n'
260+unlines = A.concatWithSuffix '\n'
261
261
262-- | Flattens the stream of @Array Char@, after appending a separating
262-- | Flattens the stream of @Array Char@, after appending a separating
263-- space to each string.
263-- space to each string.
@@ -268,7 +268,7 @@ unlines = AS.unlinesBy '\n'
268-- "unwords this string"
268-- "unwords this string"
269--
269--
270--
270--
271−-- > unwords = AS.flatten . (S.intersperse (A.fromList " "))
271+-- > unwords = A.concat . (S.intersperse (A.fromList " "))
272--
272--
273-- Note that, in general
273-- Note that, in general
274--
274--
src/Streamly/Memory/Array.hs+1−1
@@ -127,7 +127,7 @@ module Streamly.Memory.Array
127 -- ** Elimination
127 -- ** Elimination
128 , AS.concat
128 , AS.concat
129 -- , AS.concatRev
129 -- , AS.concatRev
130− , AS.unlinesBy
130+ , AS.concatWithSuffix
131 , AS.toArray
131 , AS.toArray
132
132
133 -- ** Transformation
133 -- ** Transformation
src/Streamly/Memory/ArrayStream.hs+4−4
@@ -26,7 +26,7 @@ module Streamly.Memory.ArrayStream
26 -- * Flattening to elements
26 -- * Flattening to elements
27 , concat
27 , concat
28 , concatRev
28 , concatRev
29− , unlinesBy
29+ , concatWithSuffix
30
30
31 -- * Transformation
31 -- * Transformation
32 , splitOn
32 , splitOn
@@ -87,10 +87,10 @@ concatRev m = D.fromStreamD $ A.flattenArraysRev (D.toStreamD m)
87-- array.
87-- array.
88--
88--
89-- @since 0.7.0
89-- @since 0.7.0
90−{-# INLINE unlinesBy #-}
90+{-# INLINE concatWithSuffix #-}
91−unlinesBy :: (MonadIO m, IsStream t, Storable a)
91+concatWithSuffix :: (MonadIO m, IsStream t, Storable a)
92 => a -> t m (Array a) -> t m a
92 => a -> t m (Array a) -> t m a
93−unlinesBy x = D.fromStreamD . A.unlines x . D.toStreamD
93+concatWithSuffix x = D.fromStreamD . A.unlines x . D.toStreamD
94
94
95-- | Split a stream of arrays on a given separator byte, dropping the separator
95-- | Split a stream of arrays on a given separator byte, dropping the separator
96-- and coalescing all the arrays between two separators into a single array.
96-- and coalescing all the arrays between two separators into a single array.