on master help sign in
Change the argument order of Unfold.many
commit3012ae95e532a9520450e315ef3edecf8b1af69a authorRanjeet Kumar Ranjan <ranjeetr@composewell.com> dateMon 14 Mar 2022, 15:03 (5 years ago) parent7da8c79
7 files changed+11−11
benchmark/Streamly/Benchmark/FileSystem/Handle/ReadWrite.hs+2−2 core/src/Streamly/Internal/Data/Unfold/Type.hs+2−2 src/Streamly/Internal/FileSystem/File.hs+1−1 src/Streamly/Internal/FileSystem/Handle.hs+3−3 src/Streamly/Internal/Network/Inet/TCP.hs+1−1 src/Streamly/Internal/Network/Socket.hs+1−1 test/Streamly/Test/Data/Unfold.hs+1−1
benchmark/Streamly/Benchmark/FileSystem/Handle/ReadWrite.hs+2−2
@@ -135,7 +135,7 @@ _readChunks inh devNull = IUF.fold fld unf inh
135135 where
136136
137137 fld = FH.write devNull
138− unf = IUF.many FH.readChunks A.read
138+ unf = IUF.many A.read FH.readChunks
139139
140140-- | Send the chunk content to /dev/null
141141-- Implicitly benchmarked via 'readWithBufferOfFromBytesNull'
@@ -145,7 +145,7 @@ _readChunksWithBufferOf inh devNull = IUF.fold fld unf (defaultChunkSize, inh)
145145 where
146146
147147 fld = FH.write devNull
148− unf = IUF.many FH.readChunksWithBufferOf A.read
148+ unf = IUF.many A.read FH.readChunksWithBufferOf
149149
150150
151151o_1_space_copy_fromBytes :: BenchEnv -> [Benchmark]
core/src/Streamly/Internal/Data/Unfold/Type.hs+2−2
@@ -572,8 +572,8 @@ data ConcatState s1 s2 = ConcatOuter s1 | ConcatInner s1 s2
572572-- /Since: 0.8.0/
573573--
574574{-# INLINE_NORMAL many #-}
575−many :: Monad m => Unfold m a b -> Unfold m b c -> Unfold m a c
576−many (Unfold step1 inject1) (Unfold step2 inject2) = Unfold step inject
575+many :: Monad m => Unfold m b c -> Unfold m a b -> Unfold m a c
576+many (Unfold step2 inject2) (Unfold step1 inject1) = Unfold step inject
577577
578578 where
579579
src/Streamly/Internal/FileSystem/File.hs+1−1
@@ -293,7 +293,7 @@ readWithBufferOf = usingFile2 FH.readWithBufferOf
293293-- @since 0.7.0
294294{-# INLINE read #-}
295295read :: (MonadCatch m, MonadAsync m) => Unfold m FilePath Word8
296−read = UF.many (usingFile FH.readChunks) A.read
296+read = UF.many A.read (usingFile FH.readChunks)
297297
298298-- | Generate a stream of bytes from a file specified by path. The stream ends
299299-- when EOF is encountered. File is locked using multiple reader and single
src/Streamly/Internal/FileSystem/Handle.hs+3−3
@@ -343,12 +343,12 @@ readChunks = UF.supplyFirst defaultChunkSize readChunksWithBufferOf
343343-- | Unfolds the tuple @(bufsize, handle)@ into a byte stream, read requests
344344-- to the IO device are performed using buffers of @bufsize@.
345345--
346−-- >>> readWithBufferOf = Unfold.many Handle.readChunksWithBufferOf Array.read
346+-- >>> readWithBufferOf = Unfold.many Array.read Handle.readChunksWithBufferOf
347347--
348348-- @since 0.7.0
349349{-# INLINE readWithBufferOf #-}
350350readWithBufferOf :: MonadIO m => Unfold m (Int, Handle) Word8
351−readWithBufferOf = UF.many readChunksWithBufferOf A.read
351+readWithBufferOf = UF.many A.read readChunksWithBufferOf
352352
353353-- | @toBytesWithBufferOf bufsize handle@ reads a byte stream from a file
354354-- handle, reads are performed in chunks of up to @bufsize@.
@@ -373,7 +373,7 @@ toBytesWithBufferOf size h = AS.concat $ toChunksWithBufferOf size h
373373-- @since 0.7.0
374374{-# INLINE read #-}
375375read :: MonadIO m => Unfold m Handle Word8
376−read = UF.many readChunks A.read
376+read = UF.many A.read readChunks
377377
378378-- | Generate a byte stream from a file 'Handle'.
379379--
src/Streamly/Internal/Network/Inet/TCP.hs+1−1
@@ -314,7 +314,7 @@ withConnection addr port =
314314{-# INLINE read #-}
315315read :: (MonadCatch m, MonadAsync m)
316316 => Unfold m ((Word8, Word8, Word8, Word8), PortNumber) Word8
317−read = UF.many (usingConnection ISK.readChunks) A.read
317+read = UF.many A.read (usingConnection ISK.readChunks)
318318
319319-- | Read a stream from the supplied IPv4 host address and port number.
320320--
src/Streamly/Internal/Network/Socket.hs+1−1
@@ -430,7 +430,7 @@ toBytes = AS.concat . toChunks
430430-- @since 0.7.0
431431{-# INLINE readWithBufferOf #-}
432432readWithBufferOf :: MonadIO m => Unfold m (Int, Socket) Word8
433−readWithBufferOf = UF.many readChunksWithBufferOf A.read
433+readWithBufferOf = UF.many A.read readChunksWithBufferOf
434434
435435-- | Unfolds a 'Socket' into a byte stream. IO requests to the socket are
436436-- performed in sizes of
test/Streamly/Test/Data/Unfold.hs+1−1
@@ -545,7 +545,7 @@ concat :: Bool
545545concat =
546546 let unfIn = UF.replicateM 10
547547 unfOut = UF.map return UF.enumerateFromToIntegral
548− unf = UF.many unfOut unfIn
548+ unf = UF.many unfIn unfOut
549549 lst = Prelude.concat $ Prelude.map (Prelude.replicate 10) [1 .. 10]
550550 in testUnfoldD unf (1, 10) lst
551551