on master help sign in
Make sequence concurrent
c6bc139Ranjeet Kumar Ranjan
src/Streamly/Internal/Data/Stream/IsStream/Transform.hs+1−1
@@ -437,7 +437,7 @@ mapMSerial = Serial.mapM
437-- @since 0.1.0
437-- @since 0.1.0
438{-# INLINE sequence #-}
438{-# INLINE sequence #-}
439sequence :: (IsStream t, MonadAsync m) => t m (m a) -> t m a
439sequence :: (IsStream t, MonadAsync m) => t m (m a) -> t m a
440−sequence m = fromStreamS $ S.sequence (toStreamS m)
440+sequence = mapM id
441
441
442------------------------------------------------------------------------------
442------------------------------------------------------------------------------
443-- Mapping side effects
443-- Mapping side effects
test/Streamly/Test/Prelude/Concurrent.hs+4
@@ -164,6 +164,10 @@ concurrentOps constr desc eq t = do
164 concurrentMapM constr eq $ \n mv stream ->
164 concurrentMapM constr eq $ \n mv stream ->
165 t $ S.mapM (mvarSequenceOp mv n) stream
165 t $ S.mapM (mvarSequenceOp mv n) stream
166
166
167+ prop1 (desc <> " sequence") $
168+ concurrentMapM constr eq $ \n mv stream ->
169+ t $ S.sequence $ S.map (mvarSequenceOp mv n) stream
170+
167-------------------------------------------------------------------------------
171-------------------------------------------------------------------------------
168-- Concurrent Application
172-- Concurrent Application
169-------------------------------------------------------------------------------
173-------------------------------------------------------------------------------