-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | ByteString and Text streams for networking
--
-- Provides bytestring and text streams which support both retry's and
-- invalidation for sending information before all information is known.
-- Includes support for enumerating over the chunks of bytes or chunks of
-- text sent.
@package network-stream
@version 0.1.0
-- | Network streams for use with lazy ByteStringa.
--
-- One can also send data in chunks, sending data whenever it is ready,
-- and the data will be collected transparently to the client interface.
--
-- An enumerator version is also available in which an iteratee is given
-- each chunk of data invididually.
module Network.ByteString.Lazy.Stream
-- | Represents whether the stream transaction was a success or a failure;
-- nothing is done by the library with the attached value. If you do not
-- need to send back a value to the caller of withStream, you can
-- use a Result ().
data Result a
Success :: a -> Result a
Failure :: a -> Result a
-- | The core data type for a Stream. It can only be created using
-- withStream.
data Stream
-- | Doesn't fail, but tells the client that all the data sent by the
-- stream so far has been invalidated, and hence the queue of messages to
-- be sent is cleared.
invalidate :: Stream -> IO ()
-- | Opens a stream using the given handle and passes it to the function,
-- and then unwraps the result given and gives any user data that the
-- specific function wants to give back.
withStream :: Handle -> (Stream -> IO (Result a)) -> IO a
-- | Writes partial or full data over a Stream, placing it in the
-- queue of all of the partial data.
write :: Stream -> ByteString -> IO ()
-- | Serializes data and sends it over a newly created Stream.
send :: Binary a => Handle -> a -> IO ()
-- | Receives a ByteString sent via a Stream.
receive :: Handle -> IO (Maybe ByteString)
-- | Enumerator-based version of receive that allows the client to fold
-- over the data as it is being received. Each ByteString is a
-- single chunk sent from write. Keep in mind that any IO
-- performed is dangerous if you are possibly expected an Invalidation,
-- since then that IO could end up being incorrect. Hence, it is more
-- useful to simply use this in a pure manner to build up some result
-- data as the bytes are being streamed in.
receiveE :: MonadIO m => Handle -> Iteratee ByteString m b -> m (Maybe b)
instance Typeable StreamEnumException
instance Read StreamItem
instance Show StreamItem
instance Read a => Read (Result a)
instance Show a => Show (Result a)
instance Read StreamEnumException
instance Show StreamEnumException
instance Exception StreamEnumException
instance Binary StreamItem
-- | Streams using Text by encoding in Utf 8.
module Network.Text.Lazy.Stream
-- | Represents whether the stream transaction was a success or a failure;
-- nothing is done by the library with the attached value. If you do not
-- need to send back a value to the caller of withStream, you can
-- use a Result ().
data Result a
Success :: a -> Result a
Failure :: a -> Result a
-- | The core data type for a Stream. It can only be created using
-- withStream.
data Stream
-- | Doesn't fail, but tells the client that all the data sent by the
-- stream so far has been invalidated, and hence the queue of messages to
-- be sent is cleared.
invalidate :: Stream -> IO ()
-- | Opens a stream using the given handle and passes it to the function,
-- and then unwraps the result given and gives any user data that the
-- specific function wants to give back.
withStream :: Handle -> (Stream -> IO (Result a)) -> IO a
-- | Writes partial or full data over a Stream, placing it in the
-- queue of data to be sent. Encodes the Text with Utf8 into a
-- strict Data.ByteString.Lazy.ByteString.
write :: Stream -> Text -> IO ()
receive :: Handle -> IO (Maybe Text)
-- | Receives the entire data should the transfer over the stream be
-- successful. Returns Nothing on failure.
--
-- Run an iteratee through an enumerator which supplies each block of
-- Text.
receiveE :: MonadIO m => Handle -> Iteratee Text m b -> m (Maybe b)
-- | Network streams for use with strict ByteStrings. For lazy
-- ByteString's, see Network.ByteString.Lazy.Stream. Use this
-- module with Serialize to send data over a stream without
-- worrying about sending and receiving the lengths.
--
-- One can also send data in chunks, sending data whenever it is ready,
-- and the data will be collected transparently to the client interface.
module Network.ByteString.Stream
-- | Represents whether the stream transaction was a success or a failure;
-- nothing is done by the library with the attached value. If you do not
-- need to send back a value to the caller of withStream, you can
-- use a Result ().
data Result a
Success :: a -> Result a
Failure :: a -> Result a
-- | The core data type for a Stream. It can only be created using
-- withStream.
data Stream
-- | Doesn't fail, but tells the client that all the data sent by the
-- stream so far has been invalidated, and hence the queue of messages to
-- be sent is cleared.
invalidate :: Stream -> IO ()
-- | Opens a stream using the given handle and passes it to the function,
-- and then unwraps the result given and gives any user data that the
-- specific function wants to give back.
withStream :: Handle -> (Stream -> IO (Result a)) -> IO a
-- | Writes partial or full data over a Stream, placing it in the
-- queue of all of the partial data.
write :: Stream -> ByteString -> IO ()
-- | Serializes data and sends it over a newly created Stream.
send :: Serialize a => Handle -> a -> IO ()
-- | Receives a ByteString sent via a Stream.
receive :: Handle -> IO (Maybe ByteString)
-- | Enumerator-based version of receive that allows the client to fold
-- over the data as it is being received. Each ByteString is a
-- single chunk sent from write. Keep in mind that any IO
-- performed is dangerous if you are possibly expected an Invalidation,
-- since then that IO could end up being incorrect. Hence, it is more
-- useful to simply use this in a pure manner to build up some result
-- data as the bytes are being streamed in.
receiveE :: MonadIO m => Handle -> Iteratee ByteString m b -> m (Maybe b)
instance Typeable StreamEnumException
instance Read StreamItem
instance Show StreamItem
instance Read a => Read (Result a)
instance Show a => Show (Result a)
instance Read StreamEnumException
instance Show StreamEnumException
instance Exception StreamEnumException
instance Serialize StreamItem
-- | Streams using Text by encoding in Utf 8.
module Network.Text.Stream
-- | Represents whether the stream transaction was a success or a failure;
-- nothing is done by the library with the attached value. If you do not
-- need to send back a value to the caller of withStream, you can
-- use a Result ().
data Result a
Success :: a -> Result a
Failure :: a -> Result a
-- | The core data type for a Stream. It can only be created using
-- withStream.
data Stream
-- | Doesn't fail, but tells the client that all the data sent by the
-- stream so far has been invalidated, and hence the queue of messages to
-- be sent is cleared.
invalidate :: Stream -> IO ()
-- | Opens a stream using the given handle and passes it to the function,
-- and then unwraps the result given and gives any user data that the
-- specific function wants to give back.
withStream :: Handle -> (Stream -> IO (Result a)) -> IO a
-- | Writes partial or full data over a Stream, placing it in the
-- queue of data to be sent. Encodes the Data.Text.Text with
-- Utf8 into a strict Data.ByteString.ByteString.
write :: Stream -> Text -> IO ()
-- | Receives the entire data should the transfer over the stream be
-- successful. Returns Nothing on failure.
receive :: Handle -> IO (Maybe Text)
-- | Run an iteratee through an enumerator which supplies each block of
-- Text.
receiveE :: MonadIO m => Handle -> Iteratee Text m b -> m (Maybe b)