module Streaming.Concurrent.Lifted
(
Buffer
, unbounded
, bounded
, latest
, newest
, withBuffer
, InBasket(..)
, OutBasket(..)
, writeStreamBasket
, readStreamBasket
, mergeStreams
, writeByteStringBasket
, readByteStringBasket
, mergeByteStrings
) where
import Data.ByteString.Streaming (ByteString)
import Streaming (Of, Stream)
import Streaming.Concurrent (Buffer, InBasket(..), OutBasket(..),
bounded, latest, newest, unbounded)
import qualified Streaming.Concurrent as SC
import Streaming.With.Lifted (Withable(..))
import Control.Monad.Base (MonadBase)
import Control.Monad.Trans.Control (MonadBaseControl)
import qualified Data.ByteString as B
mergeStreams :: (Withable w, MonadBaseControl IO (WithMonad w), MonadBase IO m, Foldable t)
=> Buffer a -> t (Stream (Of a) (WithMonad w) v)
-> w (Stream (Of a) m ())
mergeStreams buff strs = liftWith (SC.mergeStreams buff strs)
mergeByteStrings :: (Withable w, MonadBaseControl IO (WithMonad w), MonadBase IO n, Foldable t)
=> Buffer B.ByteString -> t (ByteString (WithMonad w) v)
-> w (ByteString n ())
mergeByteStrings buff bss = liftWith (SC.mergeByteStrings buff bss)
writeStreamBasket :: (Withable w, MonadBase IO (WithMonad w))
=> Stream (Of a) (WithMonad w) r -> InBasket a -> w ()
writeStreamBasket stream ib = liftAction (SC.writeStreamBasket stream ib)
writeByteStringBasket :: (Withable w, MonadBase IO (WithMonad w))
=> ByteString (WithMonad w) r -> InBasket B.ByteString -> w ()
writeByteStringBasket bs ib = liftAction (SC.writeByteStringBasket bs ib)
readStreamBasket :: (Withable w, MonadBase IO m) => OutBasket a -> w (Stream (Of a) m ())
readStreamBasket ob = liftWith (SC.readStreamBasket ob)
readByteStringBasket :: (Withable w, MonadBase IO m)
=> OutBasket B.ByteString -> w (ByteString m ())
readByteStringBasket ob = liftWith (SC.readByteStringBasket ob)
withBuffer :: (Withable w, MonadBaseControl IO (WithMonad w))
=> Buffer a -> (InBasket a -> WithMonad w i) -> w (OutBasket a)
withBuffer buffer sendIn = liftWith (SC.withBuffer buffer sendIn)