-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Common patterns in message-oriented applications -- -- In distributed, message-oriented applications, similar communication -- patterns are used over and over again, such as Server/Client (a.k.a -- Request/Response), Publish/Subscribe, Pipline (a.k.a. Push/Pull) and -- Exclusive Pair (a.k.a. Peer-to-Peer). The Patterns package implements -- those patterns based on zeromq. More information on zeromq can be -- found at http://www.zeromq.org. More examples and a test suite -- are available on http://github.com/toschoo/mom. @package patterns @version 0.0.3 -- | Enumerators for basic patterns module Network.Mom.Patterns.Enumerator -- | Calls an application-defined getter function until this returns -- Nothing; if the getter throws an exception, the enumerator -- returns Error. enumWith :: (i -> IO (Maybe o)) -> i -> Enumerator o IO () -- | Calls the application-defined getter function n times; -- The enumerator receives a pair (Int, Int), where the -- first integer is a counter and the second is the upper bound. n -- is defined as snd - fst, i.e. the counter is incremented -- until it reaches the value of the bound. The counter must be a value -- less than the bound to avoid protocol errors, i.e. the -- getter must be called at least once. The current value of the -- counter and additional input are passed to the getter. if the -- getter throws an exception, the enumerator returns Error. enumFor :: (Int -> i -> IO o) -> (Int, Int) -> i -> Enumerator o IO () -- | Calls the application-defined getter function once; the -- enumerator must return a value (the result type is not Maybe), -- otherwise, the sending iteratee has nothing to send which would most -- likely result in a protocol error. if the getter throws an exception, -- the enumerator returns Error. once :: (i -> IO o) -> i -> Enumerator o IO () -- | Passes just the input value to iteratee; -- --
-- just "hello world" ---- -- hence, reduces to just hello world sent over the wire. just :: o -> Enumerator o IO () -- | Enumerator to process data segments of type o; receives -- the Context, the control parameter and an input of type -- i; Fetch is used by Servers that receive -- requests of type i and produce an outgoing stream with segments -- of type o. type Fetch i o = Context -> Parameter -> i -> Enumerator o IO () -- | A variant of Fetch without input type Fetch_ o = Fetch () o -- | A function that may be used with some of the fetchers; The helper -- returns Nothing to signal that no more data are available and -- Just o to continue the stream. FetchHelpers are used -- with Servers that receive requests of type i. The -- function receives the Context, the conrol parameter and an -- input of type i; type FetchHelper i o = Context -> Parameter -> i -> IO (Maybe o) -- | A variant of FetchHelper that returns type o instead of -- Maybe o. Please note that ' does not mean -- strict, here; it just means that the result is not a -- Maybe. type FetchHelper' i o = Context -> Parameter -> i -> IO o -- | A variant of FetchHelper without input type FetchHelper_ o = FetchHelper () o -- | A variant of FetchHelper_ that returns type o instead of -- Maybe o. Please note that ' does not mean -- strict, here; it just means that the result is not a -- Maybe. type FetchHelper_' o = FetchHelper' () o -- | Calls the application-defined FetchHelper until it returns -- Nothing; note that the FetchHelper shall return at least -- one Just value to avoid a protocol error. If the -- FetchHelper throws an exception, the fetcher returns -- Error. fetcher :: FetchHelper i o -> Fetch i o -- | A variant of fetcher without input; fetcher_ :: FetchHelper_ o -> Fetch_ o -- | Calls the application-defined FetchHelper' once; If the -- FetchHelper' throws an exception, the fetcher returns -- Error. fetch1 :: FetchHelper' i o -> Fetch i o -- | A variant of fetch1 without input; fetch1_ :: FetchHelper_' o -> Fetch_ o -- | Calls the application-defined getter n times; The -- getter is a variant of FetchHelper' with the current -- value of the counter as additional argument. For more details, refer -- to enumFor. fetchFor :: (Context -> Parameter -> Int -> i -> IO o) -> (Int, Int) -> Fetch i o -- | A variant of fetchFor without input fetchFor_ :: (Context -> Parameter -> Int -> () -> IO o) -> (Int, Int) -> Fetch_ o -- | Passes just the input value to the iteratee; -- --
-- fetchJust "hello world" ---- -- hence, reduces to just "hello world" sent over the wire. Note that the -- input i is ignored. fetchJust :: o -> Fetch i o -- | A variant of fetchJust without input fetchJust_ :: o -> Fetch_ o -- | Calls the iteratee for each element of the input list listFetcher :: Fetch [o] o -- | A variant of listFetcher for services without input; the list, -- in this case, is passed as an additional argument to the fetcher. listFetcher_ :: [o] -> Fetch_ o -- | Returns one value of type i; if the enumerator creates a value, -- this value is returned; otherwise, the input value is returned. one :: i -> Iteratee i IO i -- | Returns one value of type Maybe i; equal to head mbOne :: Iteratee i IO (Maybe i) -- | Returns a list containing all chunks of the stream; equal to -- consume; note that this iteratee causes a space leak and is not -- suitable for huge streams or streams of unknown size. toList :: Iteratee i IO [i] -- | Returns a string containing all chunks of the stream intercalated with -- the input string, e.g.: if the stream consists of the two -- elements "hello" and "world" -- --
-- toString " " ---- -- returns hello world. Note that this iteratee causes a space -- leak and is not suitable for huge streams or streams of unknown size. toString :: String -> Iteratee String IO String -- | Merges the elements of a stream using mappend; if the stream is -- empty, append returns mempty. The type i must be -- instance of Monoid. Note that this iteratee causes a space leak -- and is not suitable for huge streams or streams of unknown size. append :: Monoid i => Iteratee i IO i -- | Calls the application-defined IO action for each element of the -- stream; The IO action could, for instance, write to an already opened -- file, store values in an MVar or send them through a -- Chan to another thread for further processing. An exception -- thrown in the IO action is re-thrown by throwError. store :: (i -> IO ()) -> Iteratee i IO () -- | Iteratee to process data segments of type i; receives -- the Context and the control parameter type Dump i = Context -> Parameter -> Iteratee i IO () -- | Opens a data sink, dumps the stream into this sink and closes the sink -- when the stream terminates or when an error occurs; the first IO -- action is used to open the sink (of type s), the second closes -- the sink and the third writes one element into the sink. sink :: (Context -> String -> IO s) -> (Context -> String -> s -> IO ()) -> (Context -> String -> s -> i -> IO ()) -> Dump i -- | Variant of sink that uses the first segment of the stream as -- input parameter to open the sink. The first segment, which could -- contain a file name or parameters for an SQL query, is not -- written to the sink. As with sink, the sink is closed when the -- stream terminates or when an error occurs. sinkI :: (Context -> String -> i -> IO s) -> (Context -> String -> s -> IO ()) -> (Context -> String -> s -> i -> IO ()) -> Dump i -- | Similar to sink, but uses a data sink that is opened and closed -- outside the scope of the service or does not need to be opened and -- closed at all; examples may be services that write to MVar or -- Chan. nosink is implemented as a closure of -- store: -- --
-- nosink save ctx p = store (save ctx p) --nosink :: (Context -> String -> i -> IO ()) -> Dump i module Network.Mom.Patterns.Device -- | Starts a device and executes an action that receives a Service -- to control the device -- -- Parameters: -- --
-- -- withQueue ctx name (dealer, ld) (router, lr) onerr act = -- withDevice ctx name noparam (-1) -- [pollEntry "clients" XDealer dealer ld [], -- pollEntry "server" XRouter router lr []] -- return return onerr (_ -> return ()) (_ -> putThrough) act --withQueue :: Context -> String -> (AccessPoint, LinkType) -> (AccessPoint, LinkType) -> OnError_ -> (Service -> IO a) -> IO a -- | Starts a Forwarder; a forwarder connects a publisher and its -- subscribers. Note that the forwarder uses a subscriber -- (XSub) to conntect to the publisher and a -- publisher (XPub) to bind the subscribers. -- -- Parameters: -- --
-- -- withForwarder ctx name topics (sub, pub) onerr act = -- withDevice ctx name noparam (-1) -- [pollEntry "subscriber" XSub router Connect topics, -- pollEntry "publisher" XPub dealer Bind []] -- return return onerr (_ -> return ()) (_ -> putThrough) act --withForwarder :: Context -> String -> [Topic] -> (AccessPoint, LinkType) -> (AccessPoint, LinkType) -> OnError_ -> (Service -> IO a) -> IO a -- | Starts a pipeline; a pipeline connects a pipe and its -- workers. Note that the pipeline uses a puller -- (XPull) to conntect to the pipe and a pipe -- (XPipe) to bind the pullers. -- -- Parameters: -- --
-- -- withPipeline ctx name topics (puller, l1) (pusher, l2) onerr act = -- withDevice ctx name noparam (-1) -- [pollEntry "pull" XPull puller l1 [], -- pollEntry "push" XPush pusher l2 []] -- return return onerr (_ -> return ()) (_ -> putThrough) act --withPipeline :: Context -> String -> (AccessPoint, LinkType) -> (AccessPoint, LinkType) -> OnError_ -> (Service -> IO a) -> IO a -- | A poll entry describes how to handle an AccessPoint data PollEntry -- | Creates a PollEntry; -- -- Parameters: -- --
-- broadcast :: Streamer o -> [Identifier] -- broadcast s = filterTargets s notSource -- where notSource = (/=) (getStreamSource s) --filterTargets :: Streamer o -> (Identifier -> Bool) -> [Identifier] -- | A transformer is an Iteratee to transform streams. It receives -- two arguments: -- --
-- withContext 1 $ \ctx -> do -- c <- connectODBC "DSN=xyz" -- some ODBC connection -- s <- prepare c "select ..." -- some database query -- withServer ctx -- "MyQuery" -- name of the server is "MyQuery" -- noparam -- no parameter -- 5 -- five worker threads -- (Address "tcp://*:5555" []) Bind -- bind to this address -- iconv oconv -- some standard converters -- onErr -- some standard error handler -- (\_ -> one []) -- Iteratee for single segment messages; -- -- refer to Enumerator for details -- (dbFetcher s) $ \srv -> -- the Enumerator; -- untilInterrupt $ do -- install a signal handler for SIGINT -- -- and repeat the following action -- -- until SIGINT is received; -- putStrLn $ "server " ++ srvName srv ++ -- " up and running..." -- threadDelay 1000000 ---- -- The untilInterrupt loop may be implemented as follows: -- --
-- untilInterrupt :: IO () -> IO () -- untilInterrupt run = do -- continue <- newMVar True -- _ <- installHandler sigINT (Catch $ handler continue) Nothing -- go continue -- where handler m = modifyMVar_ m (\_ -> return False) -- go m = do run -- continue <- readMVar m -- when continue $ go m ---- -- Finally, a simple dbFetcher: -- --
-- dbFetcher :: SQL.Statement -> Fetch [SQL.SqlValue] String -- dbFetcher s _ _ _ stp = tryIO (SQL.execute s []) >>= \_ -> go stp -- where go step = -- case step of -- E.Continue k -> do -- mbR <- tryIO $ SQL.fetchRow s -- case mbR of -- Nothing -> E.continue k -- -- convRow is not defined here -- Just r -> go $$ k (E.Chunks [convRow r]) -- _ -> E.returnI step --withServer :: Context -> String -> Parameter -> Int -> AccessPoint -> LinkType -> InBound c -> OutBound o -> OnError -> (String -> Iteratee c IO i) -> Fetch i o -> (Service -> IO a) -> IO a -- | Client data type data Client i o -- | Obtaining the Context from Client clientContext :: Client i o -> Context -- | Setting SocketOption to the underlying ZMQ Socket setClientOptions :: Client i o -> [SocketOption] -> IO () -- | Creates a Client; a client is not a background process like a -- server, but a data type that provides functions to interoperate with a -- server. withClient creates a client and invokes the -- application-defined action, which receives a Client argument. -- The lifetime of the Client is limited to the invoked action. -- When the action terminates, the Client dies. -- -- Parameters: -- --
-- rcv :: String -> IO () -- rcv req = withContext 1 $ \ctx -> -- withClient ctx -- (Address "tcp://localhost:5555" []) -- connect to this address -- (return . B.pack) (return . B.unpack) $ -- string converters -- \s -> do -- -- request with enum and outit -- ei <- request s (enum req) outit -- case ei of -- Left e -> putStrLn $ "Error: " ++ show (e::SomeException) -- Right _ -> return () ---- --
-- -- Enumerator that returns just one string -- enum :: String -> E.Enumerator String IO () -- enum = once (return . Just) ---- --
-- -- Iteratee that just writes to stdout -- outit :: E.Iteratee String IO () -- outit = do -- mbi <- EL.head -- case mbi of -- Nothing -> return () -- Just i -> liftIO (putStrLn i) >> outit ---- -- Note that this code just issues one request, which is not the most -- typical use case. It is more likely that the action will loop for ever -- and receive requests, for instance, from a user interface. request :: Client i o -> Enumerator o IO () -> Iteratee i IO a -> IO (Either SomeException a) -- | Asynchronously requesting a service; the function sends a request to -- the server without waiting for a result. -- -- Parameters: -- --
-- rcv :: String -> IO () -- rcv req = withContext 1 $ \ctx -> do -- let ap = address l "tcp://localhost:5555" [] -- withClient ctx ap -- (return . B.pack) (return . B.unpack) -- $ \s -> do -- ei <- try $ askFor s (enum req) -- case ei of -- Left e -> putStrLn $ "Error: " ++ show (e::SomeException) -- Right _ -> wait s -- -- check for results periodically -- where wait s = checkFor s outit >>= \mbei -> -- case mbei of -- Nothing -> do putStrLn "Waiting..." -- threadDelay 10000 >> wait s -- Just (Left e) -> putStrLn $ "Error: " ++ show e -- Just (Right _) -> putStrLn "Ready!" --checkFor :: Client i o -> Iteratee i IO a -> IO (Maybe (Either SomeException a)) -- | Publisher data Pub o -- | Obtaining the Context from Pub pubContext :: Pub o -> Context -- | Setting SocketOption to the underlying ZMQ Socket setPubOptions :: Pub o -> [SocketOption] -> IO () -- | Creates a publisher; A publisher is a data type that provides an -- interface to publish data to subscribers. withPub creates a -- publisher and invokes an application-defined action, which receives a -- Pub argument. The lifetime of the publisher is limited to the -- action. When the action terminates, the publisher dies. -- -- Parameter: -- --
-- withContext 1 $ \ctx -> withPub ctx -- (Address "tcp://*:5555" []) -- (return . B.pack) $ \pub -> untilInterrupt $ do -- issue pub (once weather noparam) -- threadDelay 10000 -- update every 10ms ---- --
-- -- fake weather report with some random values -- weather :: String -> IO (Maybe String) -- weather _ = do -- zipcode <- randomRIO (10000, 99999) :: IO Int -- temperature <- randomRIO (-10, 30) :: IO Int -- humidity <- randomRIO ( 10, 60) :: IO Int -- return $ Just (unwords [show zipcode, -- show temperature, -- show humidity]) --issue :: Pub o -> Enumerator o IO () -> IO () -- | Creates a background process that periodically publishes data; -- -- Parameters: -- --
-- withPeriodicPub ctx "Weather Report" noparam -- 100000 -- publish every 100ms -- (Address "tcp://*:5555" []) -- (return . B.pack) -- string converter -- onErr_ -- standard error handler -- (\_ -> fetch1 fetch) -- creates one instance -- -- of the return of "fetch"; -- -- see Enumerator for details -- $ \pub -> -- untilInterrupt $ do -- until SIGINT, see withServer for details -- threadDelay 100000 -- putStrLn $ "I am doing nothing " ++ srvName pub --withPeriodicPub :: Context -> String -> Parameter -> Timeout -> AccessPoint -> OutBound o -> OnError_ -> Fetch_ o -> (Service -> IO a) -> IO a -- | A subscription is a background service that receives and processes -- data streams from a publisher. A typical use case is an application -- that operates on periodically updated data; the subscriber would -- receive these data and and make them accessible to other threads in -- the process through an MVar. -- -- Parameters: -- --
-- withContext 1 $ \ctx -> -- withSub ctx "Weather Report" noparam -- ["10001"] -- zipcode to subscribe to -- (Address "tcp://localhost:5555" []) -- (return . B.unpack) -- onErr_ output -- Iteratee that just writes to stdout -- $ \s -> untilInterrupt $ do -- putStrLn $ "Doing nothing " ++ srvName s -- threadDelay 1000000 --withSub :: Context -> String -> Parameter -> [Topic] -> AccessPoint -> InBound i -> OnError_ -> Dump i -> (Service -> IO a) -> IO a -- | An alternative to the background subscriber (see withSub); data Sub i -- | Obtaining the Context from Sub subContext :: Sub i -> Context -- | Setting SocketOption to the underlying ZMQ Socket setSubOptions :: Sub i -> [SocketOption] -> IO () -- | Similar to Pub, a Sub is a data type that provides an -- interface to subscribe data. withSporadicSub creates a -- subscriber and invokes an application-defined action, which receives a -- Sub argument. The lifetime of the subscriber is limited to the -- action. When the action terminates, the subscriber dies. withSporadicSub :: Context -> AccessPoint -> InBound i -> [Topic] -> (Sub i -> IO a) -> IO a -- | Polling for data; If nothing has been received, the function returns -- Nothing; otherwise it returns Just the result or an -- error. -- -- Parameters: -- -- checkSub :: Sub i -> Iteratee i IO a -> IO (Maybe (Either SomeException a)) -- | Waiting for data; the function blocks the current thread, until data -- are being received from the publisher. It returns either -- SomeException or the result. -- -- Parameters: -- -- waitSub :: Sub i -> Iteratee i IO a -> IO (Either SomeException a) -- | Unsubscribe a topic unsubscribe :: Sub i -> Topic -> IO () -- | Subscribe another topic resubscribe :: Sub i -> Topic -> IO () -- | A pipeline consists of a "pusher" and a set of workers ("pullers"). -- The pusher sends jobs down the pipeline that will be assigned to one -- of the workers. The pipeline pattern is, thus, a work-balancing -- scheme. data Pipe o -- | Obtaining the Context from Pipe pipeContext :: Pipe o -> Context -- | Setting SocketOption to the underlying ZMQ Socket setPipeOptions :: Pipe o -> [SocketOption] -> IO () -- | Creates a pipeline; a Pipe is a data type that provides an -- interface to push a data stream to workers connected to the -- other side of the pipe. withPipe creates a pipeline and invokes -- an application-defined action which receives a Pipe argument. -- The lifetime of the Pipe is limited to the action. When the -- action terminates, the Pipe dies. -- -- Parameters: -- --
-- sendF :: FilePath -> IO () -- sendF f = withContext 1 $ \ctx -> do -- let ap = Address "tcp://*:5555" [] -- withPipe ctx ap return $ \p -> -- push pu (EB.enumFile f) -- file enumerator -- -- see Data.Enumerator.Binary (EB) --push :: Pipe o -> Enumerator o IO () -> IO () -- | A puller is a background service that receives and processes data -- streams from a pipeline. -- -- Parameters: -- --
-- withContext 1 $ \ctx -> -- withPuller ctx "Worker" noparam -- (Address "tcp://localhost:5555" []) -- (return . B.unpack) -- onErr_ output -- $ \s -> untilInterrupt $ do -- putStrLn "Doing nothing " ++ srvName s -- threadDelay 100000 --withPuller :: Context -> String -> Parameter -> AccessPoint -> InBound i -> OnError_ -> Dump i -> (Service -> IO a) -> IO a -- | An Exclusive Pair is a general purpose pattern of two equal peers that -- communicate with each other by sending (send) and receiving -- (receive) data. One of the peers has to bind the -- AccessPoint the other connects to it. data Peer a -- | Obtains the Context from a Peer peerContext :: Peer a -> Context -- | Sets SocketOption setPeerOptions :: Peer a -> [SocketOption] -> IO () -- | Creates a Peer; a peer is a data type that provides an -- interface to exchange data with another peer. withPeer creates -- the peer and invokes an application-defined action that receives a -- Peer argument. The lifetime of the Peer is limited to -- the action. When the action terminates, the Peer dies. -- -- Parameters: -- --
-- let iconv = return . toString --type InBound a = ByteString -> IO a -- | A simple string OutBound converter may be: -- --
-- let oconv = return . fromString --type OutBound a = a -> IO ByteString -- | InBound ByteString -> ByteString idIn :: InBound ByteString -- | OutBound ByteString -> ByteString idOut :: OutBound ByteString -- | InBound ByteString -> String inString :: InBound String -- | OutBound String -> ByteString outString :: OutBound String -- | InBound ByteString -> UTF8 String inUTF8 :: InBound String -- | OutBound UTF8 String -> ByteString outUTF8 :: OutBound String -- | Indicates criticality of the error event data Criticality -- | The current operation (e.g. processing a request) has not -- terminated properly, but the service is able to continue; the error -- may have been caused by a faulty request or other temporal conditions. -- Note that if an application-defined Iteratee or -- Enumerator results in SomeException (by means of -- throwError), the incident is classified as Error; if it -- throws an IO Error, however, the incident is classified as -- Fatal. Error :: Criticality -- | One worker thread is lost (Server only) Critical :: Criticality -- | The service cannot recover and will terminate Fatal :: Criticality -- | Error handler for servers; receives the Criticality of the -- error event, the exception, the server name and the service control -- parameter. If the error handler returns Just a -- ByteString this ByteString is sent to the client as -- error message. -- -- A good policy for implementing servers is to terminate or restart the -- Server when a Fatal or Critical error occurs -- and to send an error message to the client on a plain Error. -- The error handler, additionally, may log the incident or inform an -- administrator. type OnError = Criticality -> SomeException -> String -> Parameter -> IO (Maybe ByteString) -- | Error handler for all services but servers; receives the -- Criticality of the error event, the exception, the service name -- and the service control parameter. -- -- A good policy is to terminate or restart the service when a -- Fatal error occurs and to continue, if possible, on a plain -- Error. The error handler, additionally, may log the incident or -- inform an administrator. type OnError_ = Criticality -> SomeException -> String -> Parameter -> IO () -- | Chains IO Actions in an Enumerator together; throws -- SomeException using throwError when an error occurs chainIO :: IO a -> (a -> Iteratee b IO c) -> Iteratee b IO c -- | Chains IO Actions in an Enumerator together; returns -- Error when an error occurs chainIOe :: IO a -> (a -> Iteratee b IO c) -> Iteratee b IO c -- | Executes an IO Actions in an Iteratee; throws -- SomeException using throwError when an error occurs tryIO :: IO a -> Iteratee i IO a -- | Executes an IO Actions in an Iteratee; returns Error -- when an error occurs tryIOe :: IO a -> Iteratee i IO a -- | Generic Service data type; Service is passed to -- application-defined actions used with background services, namely -- withServer, withPeriodicPub, withSub, withPuller and withDevice. data Service -- | Obtains the service name srvName :: Service -> String -- | Obtains the Context from Service srvContext :: Service -> Context -- | Pauses the Service pause :: Service -> IO () -- | Resumes the Service resume :: Service -> IO () -- | Changes the Service control parameter changeParam :: Service -> Parameter -> IO () -- | Changes SocketOption changeOption :: Service -> SocketOption -> IO () -- | A 0MQ context representation. data Context :: * -- | Run an action with a 0MQ context. The Context supplied to your -- action will not be valid after the action either returns or -- throws an exception. withContext :: Size -> (Context -> IO a) -> IO a -- | The option to set on 0MQ sockets (cf. zmq_setsockopt and -- zmq_getsockopt manpages for details). data SocketOption :: * -- | ZMQ_AFFINITY Affinity :: Word64 -> SocketOption -- | ZMQ_BACKLOG Backlog :: CInt -> SocketOption -- | ZMQ_EVENTS Events :: PollEvent -> SocketOption -- | ZMQ_FD FD :: CInt -> SocketOption -- | ZMQ_IDENTITY Identity :: String -> SocketOption -- | ZMQ_LINGER Linger :: CInt -> SocketOption -- | ZMQ_RATE Rate :: Int64 -> SocketOption -- | ZMQ_RCVBUF ReceiveBuf :: Word64 -> SocketOption -- | ZMQ_RCVMORE ReceiveMore :: Bool -> SocketOption -- | ZMQ_RECONNECT_IVL ReconnectIVL :: CInt -> SocketOption -- | ZMQ_RECONNECT_IVL_MAX ReconnectIVLMax :: CInt -> SocketOption -- | ZMQ_RECOVERY_IVL RecoveryIVL :: Int64 -> SocketOption -- | ZMQ_SNDBUF SendBuf :: Word64 -> SocketOption -- | ZMQ_HWM HighWM :: Word64 -> SocketOption -- | ZMQ_MCAST_LOOP McastLoop :: Bool -> SocketOption -- | ZMQ_RECOVERY_IVL_MSEC RecoveryIVLMsec :: Int64 -> SocketOption -- | ZMQ_SWAP Swap :: Int64 -> SocketOption -- | Subscription Topic type Topic = String -- | Subscribe to all topics alltopics :: [Topic] -- | Subscribe to no topic notopic :: [Topic] type Timeout = Int64 -- | Control Parameter type Parameter = String -- | Ignore parameter noparam :: Parameter -- | This package implements communication patterns that are often used in -- distributed applications. The package implements a set of basic -- patterns and a device to connect basic patterns through routers, -- brokers, load balancers, etc. The package is based on the -- zeromq library, but, in some cases, deviates from the -- zeromq terminology. More information on zeromq can be -- found at http://www.zeromq.org. module Network.Mom.Patterns