conduit-network-stream-0.1: A base layer for network protocols using Conduits

Safe HaskellNone

Data.Conduit.Network.Stream

Contents

Synopsis

Network streams

Sending

class Sendable a m Source

Instances

send1 :: (Monad m, Sendable a m) => AppData m -> Source (Stream m) a -> m ()Source

Send one single ByteString over the network connection (if there is more than one ByteString in the pipe it will be discarded)

sendList :: (Monad m, Sendable a m) => AppData m -> Source (Stream m) a -> m ()Source

Send all ByteStrings in the pipe as a list over the network connection

Receiving

class Streamable source m whereSource

Methods

receive :: source -> Sink ByteString (Stream m) b -> m (ResumableSource (Stream m) ByteString, b)Source

Get the next package from a streamable source (calls next automatically)

receiveLast :: MonadResource m => ResumableSource (Stream m) ByteString -> Sink ByteString (Stream m) a -> m aSource

Get the next package from the stream and close the source afterwards

close :: MonadResource m => ResumableSource (Stream m) ByteString -> m ()Source

Close a resumable source

Manual sending/receiving

next :: MonadResource m => Conduit ByteString (Stream m) ByteStringSource

Get the next package from the stream (whether it's a single ByteString or a list)

(~~) :: Monad m => Source (Stream m) a -> Sink a (Stream m) b -> m bSource

Lifted version of ($$)

sink1 :: (Monad m, Sendable a m) => AppData m -> Sink a (Stream m) ()Source

sinkList :: (Monad m, Sendable a m) => AppData m -> Sink a (Stream m) ()Source

sinkList' :: (Monad m, Sendable a m) => AppData m -> (Sink a (Stream m) () -> Sink b (Stream m) c) -> Sink b (Stream m) cSource

Send multiple sinks in the same list