Synchronous message receiving.
Documentation
attach :: String -> IO SourceSource
returns a message source connected to the sink created by
a call to attach
tag
. If no such sink exists, an
exception is thrown.
System.Miniplex.Sink.create
tag
attachWait :: String -> IO SourceSource
Similar to attach
, but if the specified sink doesn't exist, attachWait
blocks until it becomes available.
read :: Source -> IO StringSource
Synchronously reads a message from a source (i.e. it blocks if there is currently no message available).
getMsgs :: Source -> IO [String]Source
Returns a lazy list of all messages arriving at a source (like
).
System.IO.hGetContents
detach :: Source -> IO ()Source
Disconnects from a message sink. The detached source becomes invalid and must not be used again.
withSource :: String -> (Source -> IO a) -> IO aSource
Helper function to simplify resource handling.
creates a source, calls withSource
tag bodybody
, then disconnects the source, even if
body
throws an exception.
withSourceWait :: String -> (Source -> IO a) -> IO aSource
Similar to withSource
, but calls attachWait
instead of attach
.