@@ -111,8 +111,6 @@ module Streamly.Internal.Data.Stream.Channel.Types
112 , withDiagMVar
112 , withDiagMVar
113 , printSVar
113 , printSVar
@@ -127,13 +125,11 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
127import Data.Set (Set)
125import Data.Set (Set)
128import Streamly.Internal.Data.Atomics
126import Streamly.Internal.Data.Atomics
129 (atomicModifyIORefCAS, atomicModifyIORefCAS_, storeLoadBarrier)
127 (atomicModifyIORefCAS, atomicModifyIORefCAS_, storeLoadBarrier)
130−import Streamly.Internal.Data.SVar.Type (adaptState)
131import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime)
128import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime)
132import Streamly.Internal.Data.Time.Units (AbsTime, NanoSecond64(..))
129import Streamly.Internal.Data.Time.Units (AbsTime, NanoSecond64(..))
133import System.IO (hPutStrLn, stderr)
130import System.IO (hPutStrLn, stderr)
135import qualified Data.Set as Set
132import qualified Data.Set as Set
136−import qualified Streamly.Internal.Data.StreamK as K
138------------------------------------------------------------------------------
134------------------------------------------------------------------------------
139-- Common types
135-- Common types
@@ -819,25 +815,3 @@ cleanupSVar workerSet = do
819 Prelude.mapM_ (`throwTo` ThreadAbort)
815 Prelude.mapM_ (`throwTo` ThreadAbort)
820 -- (Prelude.filter (/= self) $ Set.toList workers)
816 -- (Prelude.filter (/= self) $ Set.toList workers)
821 (Set.toList workers)
817 (Set.toList workers)
823−-------------------------------------------------------------------------------
825−-------------------------------------------------------------------------------
827−-- | @concatMapDivK useTail useHead stream@, divides the stream in head and
828−-- tail, maps a stream generator on the head and maps an action on the tail of
829−-- a stream. Returns the stream generated by the head.
831−-- Used for concurrent evaluation of streams using a Channel.
832−{-# INLINE concatMapDivK #-}
833−concatMapDivK :: Monad m =>
834− (K.StreamK m a -> m ())
835− -> (a -> K.StreamK m b)
838−concatMapDivK useTail useHead stream =
839− K.mkStream $ \st yld sng stp -> do
840− let foldShared = K.foldStreamShared st yld sng stp
841− single a = foldShared $ useHead a
842− yieldk a r = useTail r >> single a
843− in K.foldStreamShared (adaptState st) yieldk single stp stream