Rename conflicting newChannel in Append/Interleave modules

This commit is contained in:
Harendra Kumar 2023-11-27 02:38:32 +05:30
parent 931eafb88a
commit 3ea7bf24f4
3 changed files with 19 additions and 19 deletions

View File

@ -54,11 +54,11 @@ import Streamly.Internal.Control.Concurrent (MonadAsync)
import Streamly.Internal.Data.Stream (Stream)
import Streamly.Internal.Data.Stream.Concurrent.Channel.Operations
(fromChannel, fromChannelK, toChannel, toChannelK)
import Streamly.Internal.Data.Stream.Concurrent.Channel.Append
(newAppendChannel)
import Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave
(newInterleaveChannel)
import qualified Streamly.Internal.Data.Stream.Concurrent.Channel.Append
as Append
import qualified Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave
as Interleave
import qualified Streamly.Internal.Data.StreamK as K
import Streamly.Internal.Data.Stream.Concurrent.Channel.Type
@ -73,8 +73,8 @@ newChannel :: MonadAsync m =>
newChannel modifier =
let cfg = modifier defaultConfig
in if getInterleaved cfg
then Interleave.newChannel modifier
else Append.newChannel modifier
then newInterleaveChannel modifier
else newAppendChannel modifier
-- | Allocate a channel and evaluate the stream using the channel and the
-- supplied evaluator function. The evaluator is run in a worker thread.

View File

@ -7,7 +7,7 @@
-- Portability : GHC
--
-- The functions in this module are separated from the combinators using
-- these because of a GHC issue. We need to have newChannel specialized but
-- these because of a GHC issue. We need to have newAppendChannel specialized but
-- not inlined. If we keep it in the same module as its users we cannot achieve
-- that and the code becomes bloated. But if it is in a separate module we can
-- use INLINABLE and SPECIALIZE on it which makes it specialized but it is not
@ -15,7 +15,7 @@
module Streamly.Internal.Data.Stream.Concurrent.Channel.Append
(
newChannel
newAppendChannel
)
where
@ -1037,10 +1037,10 @@ getLifoSVar mrun cfg = do
-- | Create a new async style concurrent stream evaluation channel. The monad
-- state used to run the stream actions is taken from the call site of
-- newChannel.
{-# INLINABLE newChannel #-}
{-# SPECIALIZE newChannel :: (Config -> Config) -> IO (Channel IO a) #-}
newChannel :: MonadRunInIO m => (Config -> Config) -> m (Channel m a)
newChannel modifier = do
-- newAppendChannel.
{-# INLINABLE newAppendChannel #-}
{-# SPECIALIZE newAppendChannel :: (Config -> Config) -> IO (Channel IO a) #-}
newAppendChannel :: MonadRunInIO m => (Config -> Config) -> m (Channel m a)
newAppendChannel modifier = do
mrun <- askRunInIO
liftIO $ getLifoSVar mrun (modifier defaultConfig)

View File

@ -8,7 +8,7 @@
module Streamly.Internal.Data.Stream.Concurrent.Channel.Interleave
(
newChannel
newInterleaveChannel
)
where
@ -242,11 +242,11 @@ getFifoSVar mrun cfg = do
--
-- | Create a new async style concurrent stream evaluation channel. The monad
-- state used to run the stream actions is taken from the call site of
-- newChannel.
{-# INLINABLE newChannel #-}
{-# SPECIALIZE newChannel :: (Config -> Config) -> IO (Channel IO a) #-}
newChannel :: MonadAsync m =>
-- newInterleaveChannel.
{-# INLINABLE newInterleaveChannel #-}
{-# SPECIALIZE newInterleaveChannel :: (Config -> Config) -> IO (Channel IO a) #-}
newInterleaveChannel :: MonadAsync m =>
(Config -> Config) -> m (Channel m a)
newChannel modifier = do
newInterleaveChannel modifier = do
mrun <- askRunInIO
liftIO $ getFifoSVar mrun (modifier defaultConfig)