From bfff236977ad1593db4378b9e0f1998ce5b2f48c Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Tue, 13 Feb 2024 05:19:07 +0530 Subject: [PATCH] Move Stream.Concurrent.Channel to Stream.Channel --- .../Data/Stream/{Concurrent => }/Channel.hs | 28 +++++++++---------- .../Stream/{Concurrent => }/Channel/Append.hs | 10 +++---- .../{Concurrent => }/Channel/Consumer.hs | 8 +++--- .../{Concurrent => }/Channel/Dispatcher.hs | 6 ++-- .../{Concurrent => }/Channel/Interleave.hs | 8 +++--- .../{Concurrent => }/Channel/Operations.hs | 8 +++--- .../Stream/{Concurrent => }/Channel/Type.hs | 4 +-- .../Internal/Data/Stream/Concurrent.hs | 3 +- src/Streamly/Internal/Data/Stream/Prelude.hs | 5 ++-- streamly.cabal | 14 +++++----- 10 files changed, 46 insertions(+), 48 deletions(-) rename src/Streamly/Internal/Data/Stream/{Concurrent => }/Channel.hs (72%) rename src/Streamly/Internal/Data/Stream/{Concurrent => }/Channel/Append.hs (99%) rename src/Streamly/Internal/Data/Stream/{Concurrent => }/Channel/Consumer.hs (94%) rename src/Streamly/Internal/Data/Stream/{Concurrent => }/Channel/Dispatcher.hs (98%) rename src/Streamly/Internal/Data/Stream/{Concurrent => }/Channel/Interleave.hs (97%) rename src/Streamly/Internal/Data/Stream/{Concurrent => }/Channel/Operations.hs (97%) rename src/Streamly/Internal/Data/Stream/{Concurrent => }/Channel/Type.hs (98%) diff --git a/src/Streamly/Internal/Data/Stream/Concurrent/Channel.hs b/src/Streamly/Internal/Data/Stream/Channel.hs similarity index 72% rename from src/Streamly/Internal/Data/Stream/Concurrent/Channel.hs rename to src/Streamly/Internal/Data/Stream/Channel.hs index 8bb09100b..21d81c8e9 100644 --- a/src/Streamly/Internal/Data/Stream/Concurrent/Channel.hs +++ b/src/Streamly/Internal/Data/Stream/Channel.hs @@ -1,27 +1,27 @@ -- | --- Module : Streamly.Internal.Data.Stream.Concurrent.Channel +-- Module : Streamly.Internal.Data.Stream.Channel -- Copyright : (c) 2017 Composewell Technologies -- License : BSD-3-Clause -- Maintainer : streamly@composewell.com -- Stability : experimental -- Portability : GHC -module Streamly.Internal.Data.Stream.Concurrent.Channel +module Streamly.Internal.Data.Stream.Channel ( -- ** Primitives - module Streamly.Internal.Data.Stream.Concurrent.Channel.Type - , module Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher - , module Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer + module Streamly.Internal.Data.Stream.Channel.Type + , module Streamly.Internal.Data.Stream.Channel.Dispatcher + , module Streamly.Internal.Data.Stream.Channel.Consumer -- ** Allocating and Using , newChannel - , module Streamly.Internal.Data.Stream.Concurrent.Channel.Append - , module Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave + , module Streamly.Internal.Data.Stream.Channel.Append + , module Streamly.Internal.Data.Stream.Channel.Interleave , withChannel , withChannelK -- quiesceChannel -- wait for running tasks but do not schedule any more. -- ** Conversions - , module Streamly.Internal.Data.Stream.Concurrent.Channel.Operations + , module Streamly.Internal.Data.Stream.Channel.Operations -- ** Configuration , Config @@ -61,12 +61,12 @@ import qualified Streamly.Internal.Data.StreamK as K import Streamly.Internal.Data.Channel.Types -import Streamly.Internal.Data.Stream.Concurrent.Channel.Type -import Streamly.Internal.Data.Stream.Concurrent.Channel.Operations -import Streamly.Internal.Data.Stream.Concurrent.Channel.Append -import Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave -import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher -import Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer +import Streamly.Internal.Data.Stream.Channel.Type +import Streamly.Internal.Data.Stream.Channel.Operations +import Streamly.Internal.Data.Stream.Channel.Append +import Streamly.Internal.Data.Stream.Channel.Interleave +import Streamly.Internal.Data.Stream.Channel.Dispatcher +import Streamly.Internal.Data.Stream.Channel.Consumer -- | Create a new concurrent stream evaluation channel. The monad -- state used to run the stream actions is captured from the call site of diff --git a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Append.hs b/src/Streamly/Internal/Data/Stream/Channel/Append.hs similarity index 99% rename from src/Streamly/Internal/Data/Stream/Concurrent/Channel/Append.hs rename to src/Streamly/Internal/Data/Stream/Channel/Append.hs index cf37e2ad5..069c56505 100644 --- a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Append.hs +++ b/src/Streamly/Internal/Data/Stream/Channel/Append.hs @@ -1,5 +1,5 @@ -- | --- Module : Streamly.Internal.Data.Stream.Concurrent.Channel.Append +-- Module : Streamly.Internal.Data.Stream.Channel.Append -- Copyright : (c) 2017 Composewell Technologies -- License : BSD-3-Clause -- Maintainer : streamly@composewell.com @@ -13,7 +13,7 @@ -- use INLINABLE and SPECIALIZE on it which makes it specialized but it is not -- actually inlined. -module Streamly.Internal.Data.Stream.Concurrent.Channel.Append +module Streamly.Internal.Data.Stream.Channel.Append ( newAppendChannel ) @@ -38,11 +38,11 @@ import qualified Data.Heap as H import qualified Data.Set as Set import qualified Streamly.Internal.Data.StreamK as K -import Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer -import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher -import Streamly.Internal.Data.Stream.Concurrent.Channel.Type import Streamly.Internal.Data.Channel.Types import Streamly.Internal.Data.Channel.Worker +import Streamly.Internal.Data.Stream.Channel.Consumer +import Streamly.Internal.Data.Stream.Channel.Dispatcher +import Streamly.Internal.Data.Stream.Channel.Type ------------------------------------------------------------------------------ -- Concurrent streams with first-come-first serve results diff --git a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Consumer.hs b/src/Streamly/Internal/Data/Stream/Channel/Consumer.hs similarity index 94% rename from src/Streamly/Internal/Data/Stream/Concurrent/Channel/Consumer.hs rename to src/Streamly/Internal/Data/Stream/Channel/Consumer.hs index 6291b6fb2..91b7295b6 100644 --- a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Consumer.hs +++ b/src/Streamly/Internal/Data/Stream/Channel/Consumer.hs @@ -1,12 +1,12 @@ -- | --- Module : Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer +-- Module : Streamly.Internal.Data.Stream.Channel.Consumer -- Copyright : (c) 2017 Composewell Technologies -- License : BSD-3-Clause -- Maintainer : streamly@composewell.com -- Stability : experimental -- Portability : GHC -- -module Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer +module Streamly.Internal.Data.Stream.Channel.Consumer ( -- * Read Output readOutputQPaced @@ -23,10 +23,10 @@ import Control.Monad.IO.Class (MonadIO(liftIO)) import Data.IORef (readIORef) import Streamly.Internal.Control.Concurrent (MonadRunInIO) -import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher -import Streamly.Internal.Data.Stream.Concurrent.Channel.Type import Streamly.Internal.Data.Channel.Dispatcher import Streamly.Internal.Data.Channel.Types +import Streamly.Internal.Data.Stream.Channel.Dispatcher +import Streamly.Internal.Data.Stream.Channel.Type ------------------------------------------------------------------------------- -- Reading from the workers' output queue/buffer diff --git a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Dispatcher.hs b/src/Streamly/Internal/Data/Stream/Channel/Dispatcher.hs similarity index 98% rename from src/Streamly/Internal/Data/Stream/Concurrent/Channel/Dispatcher.hs rename to src/Streamly/Internal/Data/Stream/Channel/Dispatcher.hs index 6885da46f..ef045692b 100644 --- a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Dispatcher.hs +++ b/src/Streamly/Internal/Data/Stream/Channel/Dispatcher.hs @@ -1,5 +1,5 @@ -- | --- Module : Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher +-- Module : Streamly.Internal.Data.Stream.Channel.Dispatcher -- Copyright : (c) 2017 Composewell Technologies -- License : BSD-3-Clause -- Maintainer : streamly@composewell.com @@ -7,7 +7,7 @@ -- Portability : GHC -- -- -module Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher +module Streamly.Internal.Data.Stream.Channel.Dispatcher ( -- * Dispatching pushWorker @@ -33,10 +33,10 @@ import Streamly.Internal.Data.Time.Clock (Clock(Monotonic), getTime) import Streamly.Internal.Data.Time.Units (MicroSecond64(..), diffAbsTime64, fromRelTime64, toRelTime64) -import Streamly.Internal.Data.Stream.Concurrent.Channel.Type import Streamly.Internal.Data.Channel.Dispatcher import Streamly.Internal.Data.Channel.Types import Streamly.Internal.Data.Channel.Worker +import Streamly.Internal.Data.Stream.Channel.Type ------------------------------------------------------------------------------- -- Dispatching workers diff --git a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Interleave.hs b/src/Streamly/Internal/Data/Stream/Channel/Interleave.hs similarity index 97% rename from src/Streamly/Internal/Data/Stream/Concurrent/Channel/Interleave.hs rename to src/Streamly/Internal/Data/Stream/Channel/Interleave.hs index 4ea1eb2c7..dcdfa161d 100644 --- a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Interleave.hs +++ b/src/Streamly/Internal/Data/Stream/Channel/Interleave.hs @@ -1,12 +1,12 @@ -- | --- Module : Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave +-- Module : Streamly.Internal.Data.Stream.Channel.Interleave -- Copyright : (c) 2017 Composewell Technologies -- License : BSD-3-Clause -- Maintainer : streamly@composewell.com -- Stability : experimental -- Portability : GHC -module Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave +module Streamly.Internal.Data.Stream.Channel.Interleave ( newInterleaveChannel ) @@ -26,9 +26,9 @@ import Streamly.Internal.Data.Channel.Dispatcher (delThread) import qualified Data.Set as Set import qualified Streamly.Internal.Data.StreamK as K -import Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer -import Streamly.Internal.Data.Stream.Concurrent.Channel.Type import Streamly.Internal.Data.Channel.Types +import Streamly.Internal.Data.Stream.Channel.Consumer +import Streamly.Internal.Data.Stream.Channel.Type ------------------------------------------------------------------------------ -- Creating a channel diff --git a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Operations.hs b/src/Streamly/Internal/Data/Stream/Channel/Operations.hs similarity index 97% rename from src/Streamly/Internal/Data/Stream/Concurrent/Channel/Operations.hs rename to src/Streamly/Internal/Data/Stream/Channel/Operations.hs index 65a8fd1c7..ab41f7614 100644 --- a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Operations.hs +++ b/src/Streamly/Internal/Data/Stream/Channel/Operations.hs @@ -8,14 +8,14 @@ #endif -- | --- Module : Streamly.Internal.Data.Stream.Concurrent.Channel.Operations +-- Module : Streamly.Internal.Data.Stream.Channel.Operations -- Copyright : (c) 2017 Composewell Technologies -- License : BSD-3-Clause -- Maintainer : streamly@composewell.com -- Stability : experimental -- Portability : GHC -module Streamly.Internal.Data.Stream.Concurrent.Channel.Operations +module Streamly.Internal.Data.Stream.Channel.Operations ( toChannel , toChannelK @@ -42,9 +42,9 @@ import qualified Streamly.Internal.Data.Stream as Stream import qualified Streamly.Internal.Data.Stream as D import qualified Streamly.Internal.Data.StreamK as K -import Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher -import Streamly.Internal.Data.Stream.Concurrent.Channel.Type import Streamly.Internal.Data.Channel.Types hiding (inspect) +import Streamly.Internal.Data.Stream.Channel.Dispatcher +import Streamly.Internal.Data.Stream.Channel.Type import Prelude hiding (map, concat, concatMap) diff --git a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Type.hs b/src/Streamly/Internal/Data/Stream/Channel/Type.hs similarity index 98% rename from src/Streamly/Internal/Data/Stream/Concurrent/Channel/Type.hs rename to src/Streamly/Internal/Data/Stream/Channel/Type.hs index 4e7e9e8fe..1f409ebfe 100644 --- a/src/Streamly/Internal/Data/Stream/Concurrent/Channel/Type.hs +++ b/src/Streamly/Internal/Data/Stream/Channel/Type.hs @@ -1,12 +1,12 @@ -- | --- Module : Streamly.Internal.Data.Stream.Concurrent.Channel.Type +-- Module : Streamly.Internal.Data.Stream.Channel.Type -- Copyright : (c) 2017 Composewell Technologies -- License : BSD-3-Clause -- Maintainer : streamly@composewell.com -- Stability : experimental -- Portability : GHC -module Streamly.Internal.Data.Stream.Concurrent.Channel.Type +module Streamly.Internal.Data.Stream.Channel.Type ( Channel(..) , yieldWith diff --git a/src/Streamly/Internal/Data/Stream/Concurrent.hs b/src/Streamly/Internal/Data/Stream/Concurrent.hs index a59606143..a8c3bcaa0 100644 --- a/src/Streamly/Internal/Data/Stream/Concurrent.hs +++ b/src/Streamly/Internal/Data/Stream/Concurrent.hs @@ -8,7 +8,6 @@ -- Single effects related functionality can be moved to -- Data.Async/Control.Async. --- Stream channel to Data.Stream.Channel. module Streamly.Internal.Data.Stream.Concurrent ( @@ -92,7 +91,7 @@ import qualified Streamly.Internal.Data.StreamK as K import Prelude hiding (mapM, sequence, concat, concatMap, zipWith) import Streamly.Internal.Data.Channel.Types -import Streamly.Internal.Data.Stream.Concurrent.Channel +import Streamly.Internal.Data.Stream.Channel -- $setup -- diff --git a/src/Streamly/Internal/Data/Stream/Prelude.hs b/src/Streamly/Internal/Data/Stream/Prelude.hs index 1ca3a646e..2d67d3e6f 100644 --- a/src/Streamly/Internal/Data/Stream/Prelude.hs +++ b/src/Streamly/Internal/Data/Stream/Prelude.hs @@ -8,9 +8,8 @@ -- module Streamly.Internal.Data.Stream.Prelude ( - -- XXX Move to Stream.Channel -- * Concurrency Channels - module Streamly.Internal.Data.Stream.Concurrent.Channel + module Streamly.Internal.Data.Stream.Channel -- * Concurrent Streams , module Streamly.Internal.Data.Stream.Concurrent -- * Time @@ -20,7 +19,7 @@ module Streamly.Internal.Data.Stream.Prelude ) where +import Streamly.Internal.Data.Stream.Channel import Streamly.Internal.Data.Stream.Concurrent -import Streamly.Internal.Data.Stream.Concurrent.Channel import Streamly.Internal.Data.Stream.Time import Streamly.Internal.Data.Stream.Lifted diff --git a/streamly.cabal b/streamly.cabal index 488cb860c..39a3f4059 100644 --- a/streamly.cabal +++ b/streamly.cabal @@ -454,13 +454,13 @@ library , Streamly.Internal.Data.Channel.Dispatcher , Streamly.Internal.Data.Channel.Worker - , Streamly.Internal.Data.Stream.Concurrent.Channel.Type - , Streamly.Internal.Data.Stream.Concurrent.Channel.Dispatcher - , Streamly.Internal.Data.Stream.Concurrent.Channel.Consumer - , Streamly.Internal.Data.Stream.Concurrent.Channel.Append - , Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave - , Streamly.Internal.Data.Stream.Concurrent.Channel.Operations - , Streamly.Internal.Data.Stream.Concurrent.Channel + , Streamly.Internal.Data.Stream.Channel.Type + , Streamly.Internal.Data.Stream.Channel.Dispatcher + , Streamly.Internal.Data.Stream.Channel.Consumer + , Streamly.Internal.Data.Stream.Channel.Append + , Streamly.Internal.Data.Stream.Channel.Interleave + , Streamly.Internal.Data.Stream.Channel.Operations + , Streamly.Internal.Data.Stream.Channel , Streamly.Internal.Data.Stream.Concurrent , Streamly.Internal.Data.Stream.Time , Streamly.Internal.Data.Stream.Lifted