@@ -176,6 +176,18 @@ import qualified Streamly.Internal.Unicode.Stream as Unicode (lines)
176176
177177#include "DocTestProcess.hs"
178178
179+ -------------------------------------------------------------------------------
180+ -- Compatibility
181+ -------------------------------------------------------------------------------
182+
183+ #if MIN_VERSION_streamly_core(0,3,0)
184+ #define UNFOLD_EACH Stream.unfoldEach
185+ #define CHUNKS_OF Array.chunksOf
186+ #else
187+ #define UNFOLD_EACH Stream.unfoldMany
188+ #define CHUNKS_OF Stream.chunksOf
189+ #endif
190+
179191-------------------------------------------------------------------------------
180192-- Config
181193-------------------------------------------------------------------------------
@@ -686,11 +698,11 @@ pipeBytesEither ::
686698 -> Stream m Word8 -- ^ Input Stream
687699 -> Stream m (Either Word8 Word8 ) -- ^ Output Stream
688700pipeBytesEither path args input =
689- let input1 = Stream. chunksOf defaultChunkSize input
701+ let input1 = CHUNKS_OF defaultChunkSize input
690702 output = pipeChunksEither path args input1
691703 leftRdr = fmap Left Array. reader
692704 rightRdr = fmap Right Array. reader
693- in Stream. unfoldMany (Unfold. either leftRdr rightRdr) output
705+ in UNFOLD_EACH (Unfold. either leftRdr rightRdr) output
694706
695707-- | Like 'pipeChunks' but use the specified configuration to run the process.
696708{-# INLINE pipeChunksWith #-}
@@ -784,9 +796,9 @@ pipeBytes ::
784796 -> Stream m Word8 -- ^ Input Stream
785797 -> Stream m Word8 -- ^ Output Stream
786798pipeBytes path args input = -- rights . pipeBytesEither path args
787- let input1 = Stream. chunksOf defaultChunkSize input
799+ let input1 = CHUNKS_OF defaultChunkSize input
788800 output = pipeChunks path args input1
789- in Stream. unfoldMany Array. reader output
801+ in UNFOLD_EACH Array. reader output
790802
791803{-# DEPRECATED processBytes "Please use pipeBytes instead." #-}
792804{-# INLINE processBytes #-}
@@ -906,7 +918,7 @@ toBytesEither path args =
906918 let output = toChunksEither path args
907919 leftRdr = fmap Left Array. reader
908920 rightRdr = fmap Right Array. reader
909- in Stream. unfoldMany (Unfold. either leftRdr rightRdr) output
921+ in UNFOLD_EACH (Unfold. either leftRdr rightRdr) output
910922
911923-- | @toBytes path args@ runs the executable specified by @path@ using @args@
912924-- as arguments and returns the output of the process as a stream of bytes.
@@ -930,7 +942,7 @@ toBytes ::
930942 -> Stream m Word8 -- ^ Output Stream
931943toBytes path args =
932944 let output = toChunks path args
933- in Stream. unfoldMany Array. reader output
945+ in UNFOLD_EACH Array. reader output
934946
935947-- | Like 'toBytesEither' but generates a stream of @Array Word8@ instead of a stream
936948-- of @Word8@.
0 commit comments