unagi-streams-0.1.2: Unagi Chan IO-Streams

Safe HaskellNone
LanguageHaskell2010

System.IO.Streams.Concurrent.Unagi

Contents

Synopsis

Channel conversions

inputToChan :: InputStream a -> InChan (Maybe a) -> IO () Source

Writes the contents of an input stream to a channel until the input stream yields end-of-stream.

chanToInput :: OutChan (Maybe a) -> IO (InputStream a) Source

Turns an OutChan into an input stream.

chanToOutput :: InChan (Maybe a) -> IO (OutputStream a) Source

Turns an InChan into an output stream.

makeChanPipe :: IO (InputStream a, OutputStream a) Source

Create a new pair of streams using an underlying Chan. Everything written to the OutputStream will appear as-is on the InputStream.

Since reading from the InputStream and writing to the OutputStream are blocking calls, be sure to do so in different threads.

chanToPipe :: (InChan (Maybe a), OutChan (Maybe a)) -> IO (InputStream a, OutputStream a) Source

Create a new pair of streams form the given Chan. Everything written to the OutputStream will appear as-is on the InputStream.

Since reading from the InputStream and writing to the OutputStream are blocking calls, be sure to do so in different threads.

dupStream :: InChan (Maybe a) -> IO (InputStream a) Source

Create a new input stream duplicated from the InChan