miniplex-0.2.1: simple 1-to-N interprocess communicationContentsIndex
System.Miniplex.Source
Description
Synchronous message receiving.
Synopsis
data Source
attach :: String -> IO Source
read :: Source -> IO String
getMsgs :: Source -> IO [String]
detach :: Source -> IO ()
withSource :: String -> (Source -> IO a) -> IO a
Documentation
data Source
show/hide Instances
attach :: String -> IO Source
attach tag returns a message source connected to the sink created by a call to create tag. If no such sink exists, an exception is thrown.
read :: Source -> IO String
Synchronously reads a message from a source (i.e. it blocks if there is currently no message available).
getMsgs :: Source -> IO [String]
Returns a lazy list of all messages arriving at a source (like hGetContents).
detach :: Source -> IO ()
Disconnects from a message sink. The detached source becomes invalid and must not be used again.
withSource :: String -> (Source -> IO a) -> IO a
Helper function to simplify resource handling. withSource tag body creates a source, calls body, then disconnects the source, even if body throws an exception.
Produced by Haddock version 0.8