on master help sign in
Change the order of yld and stp continuations

The names were incorrect as per the definition of the type. This problem occurred because the order of the arguments was changed at some point but we missed changing these.

commitd35674ea027f2136c533c4893268d99ce79cf121 authorHarendra Kumar <harendra.kumar@gmail.com> dateThu 16 Jan 2020, 23:22 (7 years ago) parentbee5f1d
2 files changed+14−14
src/Streamly/Internal/Data/Stream/Ahead.hs+7−7 src/Streamly/Internal/Data/Stream/Async.hs+7−7
src/Streamly/Internal/Data/Stream/Ahead.hs+7−7
@@ -580,14 +580,14 @@ workLoopAhead q heap st sv winfo = do
580580-- The only difference between forkSVarAsync and this is that we run the left
581581-- computation without a shared SVar.
582582forkSVarAhead :: (IsStream t, MonadAsync m) => t m a -> t m a -> t m a
583−forkSVarAhead m1 m2 = mkStream $ \st stp sng yld -> do
583+forkSVarAhead m1 m2 = mkStream $ \st yld sng stp -> do
584584 sv <- newAheadVar st (concurrently (toStream m1) (toStream m2))
585585 workLoopAhead
586− foldStream st stp sng yld (fromSVar sv)
586+ foldStream st yld sng stp (fromSVar sv)
587587 where
588− concurrently ma mb = mkStream $ \st stp sng yld -> do
588+ concurrently ma mb = mkStream $ \st yld sng stp -> do
589589 liftIO $ enqueue (fromJust $ streamVar st) mb
590− foldStream st stp sng yld ma
590+ foldStream st yld sng stp ma
591591
592592-- | Polymorphic version of the 'Semigroup' operation '<>' of 'AheadT'.
593593-- Merges two streams sequentially but with concurrent lookahead.
@@ -595,15 +595,15 @@ forkSVarAhead m1 m2 = mkStream $ \st stp sng yld -> do
595595-- @since 0.3.0
596596{-# INLINE ahead #-}
597597ahead :: (IsStream t, MonadAsync m) => t m a -> t m a -> t m a
598−ahead m1 m2 = mkStream $ \st stp sng yld ->
598+ahead m1 m2 = mkStream $ \st yld sng stp ->
599599 case streamVar st of
600600 Just sv | svarStyle sv == AheadVar -> do
601601 liftIO $ enqueue sv (toStream m2)
602602 -- Always run the left side on a new SVar to avoid complexity in
603603 -- sequencing results. This means the left side cannot further
604604 -- split into more ahead computations on the same SVar.
605− foldStream st stp sng yld m1
606− _ -> foldStreamShared st stp sng yld (forkSVarAhead m1 m2)
605+ foldStream st yld sng stp m1
606+ _ -> foldStreamShared st yld sng stp (forkSVarAhead m1 m2)
607607
608608-- | XXX we can implement it more efficienty by directly implementing instead
609609-- of combining streams using ahead.
src/Streamly/Internal/Data/Stream/Async.hs+7−7
@@ -584,26 +584,26 @@ newWAsyncVar st m = do
584584
585585forkSVarAsync :: (IsStream t, MonadAsync m)
586586 => SVarStyle -> t m a -> t m a -> t m a
587−forkSVarAsync style m1 m2 = mkStream $ \st stp sng yld -> do
587+forkSVarAsync style m1 m2 = mkStream $ \st yld sng stp -> do
588588 sv <- case style of
589589 AsyncVar -> newAsyncVar st (concurrently (toStream m1) (toStream m2))
590590 WAsyncVar -> newWAsyncVar st (concurrently (toStream m1) (toStream m2))
591591 _ -> error "illegal svar type"
592− foldStream st stp sng yld $ fromSVar sv
592+ foldStream st yld sng stp $ fromSVar sv
593593 where
594− concurrently ma mb = mkStream $ \st stp sng yld -> do
594+ concurrently ma mb = mkStream $ \st yld sng stp -> do
595595 liftIO $ enqueue (fromJust $ streamVar st) mb
596− foldStreamShared st stp sng yld ma
596+ foldStreamShared st yld sng stp ma
597597
598598{-# INLINE joinStreamVarAsync #-}
599599joinStreamVarAsync :: (IsStream t, MonadAsync m)
600600 => SVarStyle -> t m a -> t m a -> t m a
601−joinStreamVarAsync style m1 m2 = mkStream $ \st stp sng yld ->
601+joinStreamVarAsync style m1 m2 = mkStream $ \st yld sng stp ->
602602 case streamVar st of
603603 Just sv | svarStyle sv == style -> do
604604 liftIO $ enqueue sv (toStream m2)
605− foldStreamShared st stp sng yld m1
606− _ -> foldStreamShared st stp sng yld (forkSVarAsync style m1 m2)
605+ foldStreamShared st yld sng stp m1
606+ _ -> foldStreamShared st yld sng stp (forkSVarAsync style m1 m2)
607607
608608------------------------------------------------------------------------------
609609-- Semigroup and Monoid style compositions for parallel actions