Safe Haskell | None |
---|---|
Language | Haskell2010 |
- inputToChan :: InputStream a -> InChan (Maybe a) -> IO ()
- chanToInput :: OutChan (Maybe a) -> IO (InputStream a)
- chanToOutput :: InChan (Maybe a) -> IO (OutputStream a)
- concurrentMerge :: [InputStream a] -> IO (InputStream a)
- makeChanPipe :: IO (InputStream a, OutputStream a)
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.
concurrentMerge :: [InputStream a] -> IO (InputStream a) Source
Concurrently merges a list of InputStream
s, combining values in the
order they become available.
Note: does not forward individual end-of-stream notifications, the produced stream does not yield end-of-stream until all of the input streams have finished.
This traps exceptions in each concurrent thread and re-raises them in the current thread.
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.