on master help sign in
Add an 'ahead' operation for ordered append
commit8480c9ee25944b50798671305d3f550e34f3b729 authorHarendra Kumar <harendra@composewell.com> dateMon 10 Oct 2022, 00:21 (4 years ago) parentb5d2641
1 file changed+9
src/Streamly/Internal/Data/Stream/Async.hs+9
src/Streamly/Internal/Data/Stream/Async.hs+9
@@ -57,6 +57,7 @@ module Streamly.Internal.Data.Stream.Async
5757 , appendWith
5858 , interleave
5959 , interleaveWith
60+ , ahead
6061 , parallel
6162 , parallelFst
6263 , parallelMin
@@ -178,6 +179,14 @@ append = appendWith id
178179interleave :: MonadAsync m => Stream m a -> Stream m a -> Stream m a
179180interleave = interleaveWith id
180181
182+-- | Like 'append' but with 'ordered' on.
183+--
184+-- >>> ahead = Async.appendWith Async.ordered
185+--
186+{-# INLINE ahead #-}
187+ahead :: MonadAsync m => Stream m a -> Stream m a -> Stream m a
188+ahead = appendWith ordered
189+
181190-- | Like 'append' but with 'eagerEval' on.
182191--
183192-- >>> parallel = Async.appendWith Async.eagerEval