zeromq4-haskell-0.8.0: Bindings to ZeroMQ 4.x

Copyright | (c) 2013 Toralf Wittner
License | MIT
Maintainer | Toralf Wittner <tw@dtex.org>
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell98

System.ZMQ4.Monadic

Contents

- Type Definitions
  - Socket type-classes
  - Socket Types
- General Operations
- ZMQ Options (Read)
- ZMQ Options (Write)
- Socket operations
- Socket Options (Read)
- Socket Options (Write)
- Error Handling
- Re-exports
- Low-level Functions

Description

This modules exposes a monadic interface of `ZMQ4`. Actions run inside a `ZMQ` monad and `Socket`s are guaranteed not to leak outside their corresponding `runZMQ` scope. Running `ZMQ` computations asynchronously is directly supported through `async`.

Synopsis

- data ZMQ z a
- data Socket z t
- data Flag
  - = DontWait
  - | SendMore
- data Switch
  - = Default
  - | On
  - | Off
- type Timeout = Int64
- data Event
  - = In
  - | Out
  - | Err
- data EventType
  - = ConnectedEvent
  - | ConnectDelayedEvent
  - | ConnectRetriedEvent
  - | ListeningEvent
  - | BindFailedEvent
  - | AcceptedEvent
  - | AcceptFailedEvent
  - | ClosedEvent
  - | CloseFailedEvent
  - | DisconnectedEvent
  - | MonitorStoppedEvent
  - | AllEvents
- data EventMsg
  - = Connected !ByteString !Fd
  - | ConnectDelayed !ByteString
  - | ConnectRetried !ByteString !Int
  - | Listening !ByteString !Fd
  - | BindFailed !ByteString !Int
  - | Accepted !ByteString !Fd
  - | AcceptFailed !ByteString !Int
  - | Closed !ByteString !Fd
  - | CloseFailed !ByteString !Int
  - | Disconnected !ByteString !Fd
  - | MonitorStopped !ByteString !Int
- data Poll (s :: Type -> Type) (m :: Type -> Type) where
  - Sock :: forall (s :: Type -> Type) t (m :: Type -> Type). s t -> [Event] -> Maybe ([Event] -> m ()) -> Poll s m
  - File :: forall (m :: Type -> Type) (s :: Type -> Type). Fd -> [Event] -> Maybe ([Event] -> m ()) -> Poll s m
- data KeyFormat a where
  - BinaryFormat :: KeyFormat Div4
  - TextFormat :: KeyFormat Div5
- data SecurityMechanism
  - = Null
  - | Plain
  - | Curve
- class SocketType a
- class Sender a
- class Receiver a
- class Subscriber a
- class SocketLike (s :: Type -> Type)
- class Conflatable a
- class SendProbe a
- data Pair = Pair
- data Pub = Pub
- data Sub = Sub
- data XPub = XPub
- data XSub = XSub
- data Req = Req
- data Rep = Rep
- data Dealer = Dealer
- data Router = Router
- data Pull = Pull
- data Push = Push
- data Stream = Stream
- version :: ZMQ z (Int, Int, Int)
- runZMQ :: MonadIO m => (forall z. ZMQ z a) -> m a
- async :: ZMQ z a -> ZMQ z (Async a)
- socket :: SocketType t => t -> ZMQ z (Socket z t)
- ioThreads :: ZMQ z Word
- maxSockets :: ZMQ z Word
- setIoThreads :: Word -> ZMQ z ()
- setMaxSockets :: Word -> ZMQ z ()
- close :: Socket z t -> ZMQ z ()
- bind :: Socket z t -> String -> ZMQ z ()
- unbind :: Socket z t -> String -> ZMQ z ()
- connect :: Socket z t -> String -> ZMQ z ()
- disconnect :: Socket z t -> String -> ZMQ z ()
- send :: Sender t => Socket z t -> [Flag] -> ByteString -> ZMQ z ()
- send' :: Sender t => Socket z t -> [Flag] -> ByteString -> ZMQ z ()
- sendMulti :: Sender t => Socket z t -> NonEmpty ByteString -> ZMQ z ()
- receive :: Receiver t => Socket z t -> ZMQ z ByteString
- receiveMulti :: Receiver t => Socket z t -> ZMQ z [ByteString]
- subscribe :: Subscriber t => Socket z t -> ByteString -> ZMQ z ()
- unsubscribe :: Subscriber t => Socket z t -> ByteString -> ZMQ z ()
- proxy :: Socket z a -> Socket z b -> Maybe (Socket z c) -> ZMQ z ()
- monitor :: [EventType] -> Socket z t -> ZMQ z (Bool -> IO (Maybe EventMsg))
- socketMonitor :: [EventType] -> String -> Socket z t -> ZMQ z ()
- poll :: forall (s :: Type -> Type) m. (SocketLike s, MonadIO m) => Timeout -> [Poll s m] -> m [[Event]]
- affinity :: Socket z t -> ZMQ z Word64
- backlog :: Socket z t -> ZMQ z Int
- conflate :: Conflatable t => Socket z t -> ZMQ z Bool
- curvePublicKey :: KeyFormat f -> Socket z t -> ZMQ z ByteString
- curveSecretKey :: KeyFormat f -> Socket z t -> ZMQ z ByteString
- curveServerKey :: KeyFormat f -> Socket z t -> ZMQ z ByteString
- delayAttachOnConnect :: Socket z t -> ZMQ z Bool
- events :: Socket z t -> ZMQ z [Event]
- fileDescriptor :: Socket z t -> ZMQ z Fd
- identity :: Socket z t -> ZMQ z ByteString
- immediate :: Socket z t -> ZMQ z Bool
- ipv4Only :: Socket z t -> ZMQ z Bool
- ipv6 :: Socket z t -> ZMQ z Bool
- lastEndpoint :: Socket z t -> ZMQ z String
- linger :: Socket z t -> ZMQ z Int
- maxMessageSize :: Socket z t -> ZMQ z Int64
- mcastHops :: Socket z t -> ZMQ z Int
- mechanism :: Socket z t -> ZMQ z SecurityMechanism
- moreToReceive :: Socket z t -> ZMQ z Bool
- plainServer :: Socket z t -> ZMQ z Bool
- plainPassword :: Socket z t -> ZMQ z ByteString
- plainUserName :: Socket z t -> ZMQ z ByteString
- rate :: Socket z t -> ZMQ z Int
- receiveBuffer :: Socket z t -> ZMQ z Int
- receiveHighWM :: Socket z t -> ZMQ z Int
- receiveTimeout :: Socket z t -> ZMQ z Int
- reconnectInterval :: Socket z t -> ZMQ z Int
- reconnectIntervalMax :: Socket z t -> ZMQ z Int
- recoveryInterval :: Socket z t -> ZMQ z Int
- sendBuffer :: Socket z t -> ZMQ z Int
- sendHighWM :: Socket z t -> ZMQ z Int
- sendTimeout :: Socket z t -> ZMQ z Int
- tcpKeepAlive :: Socket z t -> ZMQ z Switch
- tcpKeepAliveCount :: Socket z t -> ZMQ z Int
- tcpKeepAliveIdle :: Socket z t -> ZMQ z Int
- tcpKeepAliveInterval :: Socket z t -> ZMQ z Int
- zapDomain :: Socket z t -> ZMQ z ByteString
- setAffinity :: Word64 -> Socket z t -> ZMQ z ()
- setBacklog :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
- setConflate :: Conflatable t => Bool -> Socket z t -> ZMQ z ()
- setCurveServer :: Bool -> Socket z t -> ZMQ z ()
- setCurvePublicKey :: KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
- setCurveSecretKey :: KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
- setCurveServerKey :: KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
- setDelayAttachOnConnect :: Bool -> Socket z t -> ZMQ z ()
- setIdentity :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
- setImmediate :: Bool -> Socket z t -> ZMQ z ()
- setIpv4Only :: Bool -> Socket z t -> ZMQ z ()
- setIpv6 :: Bool -> Socket z t -> ZMQ z ()
- setLinger :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
- setMaxMessageSize :: Integral i => Restricted (Nneg1, Int64) i -> Socket z t -> ZMQ z ()
- setMcastHops :: Integral i => Restricted (N1, Int32) i -> Socket z t -> ZMQ z ()
- setPlainServer :: Bool -> Socket z t -> ZMQ z ()
- setPlainPassword :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
- setPlainUserName :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
- setProbeRouter :: SendProbe t => Bool -> Socket z t -> ZMQ z ()
- setRate :: Integral i => Restricted (N1, Int32) i -> Socket z t -> ZMQ z ()
- setReceiveBuffer :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
- setReceiveHighWM :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
- setReceiveTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
- setReconnectInterval :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
- setReconnectIntervalMax :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
- setRecoveryInterval :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
- setReqCorrelate :: Bool -> Socket z Req -> ZMQ z ()
- setReqRelaxed :: Bool -> Socket z Req -> ZMQ z ()
- setRouterMandatory :: Bool -> Socket z Router -> ZMQ z ()
- setSendBuffer :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
- setSendHighWM :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
- setSendTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
- setTcpAcceptFilter :: Maybe ByteString -> Socket z t -> ZMQ z ()
- setTcpKeepAlive :: Switch -> Socket z t -> ZMQ z ()
- setTcpKeepAliveCount :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
- setTcpKeepAliveIdle :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
- setTcpKeepAliveInterval :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
- setXPubVerbose :: Bool -> Socket z XPub -> ZMQ z ()
- setZapDomain :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
- data ZMQError
- errno :: ZMQError -> Int
- source :: ZMQError -> String
- message :: ZMQError -> String
- liftIO :: MonadIO m => IO a -> m a
- restrict :: Restriction r v => v -> Restricted r v
- toRestricted :: Restriction r v => v -> Maybe (Restricted r v)
- waitRead :: Socket z t -> ZMQ z ()
- waitWrite :: Socket z t -> ZMQ z ()
- z85Encode :: MonadIO m => Restricted Div4 ByteString -> m ByteString
- z85Decode :: MonadIO m => Restricted Div5 ByteString -> m ByteString
- curveKeyPair :: MonadIO m => m (Restricted Div5 ByteString, Restricted Div5 ByteString)

# Type Definitions

data ZMQ z a Source #

The ZMQ monad is modeled after `ST` and encapsulates a `Context`. It uses the uninstantiated type variable `z` to distinguish different invoctions of `runZMQ` and to prevent unintented use of `Socket`s outside their scope. Cf. the paper of John Launchbury and Simon Peyton Jones Lazy Functional State Threads.

#### Instances

Instances details

MonadBaseControl IO (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods liftBaseWith :: (RunInBase (ZMQ z) IO -> IO a) -> ZMQ z a Source # restoreM :: StM (ZMQ z) a -> ZMQ z a Source #
MonadBase IO (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods liftBase :: IO α -> ZMQ z α Source #
MonadIO (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods liftIO :: IO a -> ZMQ z a Source #
MonadCatch (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods catch :: (HasCallStack, Exception e) => ZMQ z a -> (e -> ZMQ z a) -> ZMQ z a Source #
MonadMask (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods mask :: HasCallStack => ((forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b) -> ZMQ z b Source # uninterruptibleMask :: HasCallStack => ((forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b) -> ZMQ z b Source # generalBracket :: HasCallStack => ZMQ z a -> (a -> ExitCase b -> ZMQ z c) -> (a -> ZMQ z b) -> ZMQ z (b, c) Source #
MonadThrow (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods throwM :: (HasCallStack, Exception e) => e -> ZMQ z a Source #
Applicative (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods pure :: a -> ZMQ z a Source # (<*>) :: ZMQ z (a -> b) -> ZMQ z a -> ZMQ z b Source # liftA2 :: (a -> b -> c) -> ZMQ z a -> ZMQ z b -> ZMQ z c Source # (*>) :: ZMQ z a -> ZMQ z b -> ZMQ z b Source # (<*) :: ZMQ z a -> ZMQ z b -> ZMQ z a Source #
Functor (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods fmap :: (a -> b) -> ZMQ z a -> ZMQ z b Source # (<$) :: a -> ZMQ z b -> ZMQ z a Source #
Monad (ZMQ z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods (>>=) :: ZMQ z a -> (a -> ZMQ z b) -> ZMQ z b Source # (>>) :: ZMQ z a -> ZMQ z b -> ZMQ z b Source # return :: a -> ZMQ z a Source #
type StM (ZMQ z) a Source # |
Instance details Defined in System.ZMQ4.Monadic type StM (ZMQ z) a = a

data Socket z t Source #

The ZMQ socket, parameterised by `SocketType` and belonging to a particular `ZMQ` thread.

#### Instances

Instances details

SocketLike (Socket z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods toSocket :: Socket z t -> Socket t Source #

data Flag Source #

Flags to apply on send operations (cf. man zmq_send)

Constructors

DontWait | ZMQ_DONTWAIT (Only relevant on Windows.)
SendMore | ZMQ_SNDMORE

#### Instances

Instances details

Show Flag Source # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> Flag -> ShowS Source # show :: Flag -> String Source # showList :: [Flag] -> ShowS Source #
Eq Flag Source # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: Flag -> Flag -> Bool Source # (/=) :: Flag -> Flag -> Bool Source #
Ord Flag Source # |
Instance details Defined in System.ZMQ4.Internal Methods compare :: Flag -> Flag -> Ordering Source # (<) :: Flag -> Flag -> Bool Source # (<=) :: Flag -> Flag -> Bool Source # (>) :: Flag -> Flag -> Bool Source # (>=) :: Flag -> Flag -> Bool Source # max :: Flag -> Flag -> Flag Source # min :: Flag -> Flag -> Flag Source #

data Switch Source #

Configuration switch

Constructors

Default | Use default setting
On | Activate setting
Off | De-activate setting

#### Instances

Instances details

Show Switch Source # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> Switch -> ShowS Source # show :: Switch -> String Source # showList :: [Switch] -> ShowS Source #
Eq Switch Source # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: Switch -> Switch -> Bool Source # (/=) :: Switch -> Switch -> Bool Source #
Ord Switch Source # |
Instance details Defined in System.ZMQ4.Internal Methods compare :: Switch -> Switch -> Ordering Source # (<) :: Switch -> Switch -> Bool Source # (<=) :: Switch -> Switch -> Bool Source # (>) :: Switch -> Switch -> Bool Source # (>=) :: Switch -> Switch -> Bool Source # max :: Switch -> Switch -> Switch Source # min :: Switch -> Switch -> Switch Source #

type Timeout = Int64 Source #

data Event Source #

Socket events.

Constructors

In | `ZMQ_POLLIN` (incoming messages)
Out | `ZMQ_POLLOUT` (outgoing messages, i.e. at least 1 byte can be written)

Err

    ZMQ_POLLERR

#### Instances

Instances details

Read Event Source # |
Instance details Defined in System.ZMQ4 Methods readsPrec :: Int -> ReadS Event Source # readList :: ReadS [Event] Source # readPrec :: ReadPrec Event Source # readListPrec :: ReadPrec [Event] Source #
Show Event Source # |
Instance details Defined in System.ZMQ4 Methods showsPrec :: Int -> Event -> ShowS Source # show :: Event -> String Source # showList :: [Event] -> ShowS Source #
Eq Event Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Event -> Event -> Bool Source # (/=) :: Event -> Event -> Bool Source #
Ord Event Source # |
Instance details Defined in System.ZMQ4 Methods compare :: Event -> Event -> Ordering Source # (<) :: Event -> Event -> Bool Source # (<=) :: Event -> Event -> Bool Source # (>) :: Event -> Event -> Bool Source # (>=) :: Event -> Event -> Bool Source # max :: Event -> Event -> Event Source # min :: Event -> Event -> Event Source #

data EventType Source #

Event types to monitor.

Constructors

ConnectedEvent |
ConnectDelayedEvent |
ConnectRetriedEvent |
ListeningEvent |
BindFailedEvent |
AcceptedEvent |
AcceptFailedEvent |
ClosedEvent |
CloseFailedEvent |
DisconnectedEvent |
MonitorStoppedEvent |
AllEvents |

#### Instances

Instances details

Show EventType Source # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> EventType -> ShowS Source # show :: EventType -> String Source # showList :: [EventType] -> ShowS Source #
Eq EventType Source # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: EventType -> EventType -> Bool Source # (/=) :: EventType -> EventType -> Bool Source #
Ord EventType Source # |

Instance details

Defined in System.ZMQ4.Internal

Methods

compare :: EventType -> EventType -> Ordering Source #

(<) :: EventType -> EventType -> Bool Source #

(<=) :: EventType -> EventType -> Bool Source #

(>) :: EventType -> EventType -> Bool Source #

(>=) :: EventType -> EventType -> Bool Source #

max :: EventType -> EventType -> EventType Source #

min :: EventType -> EventType -> EventType Source #

data EventMsg Source #

Event Message to receive when monitoring socket events.

Constructors

Connected !ByteString !Fd |
ConnectDelayed !ByteString |
ConnectRetried !ByteString !Int |
Listening !ByteString !Fd |
BindFailed !ByteString !Int |
Accepted !ByteString !Fd |
AcceptFailed !ByteString !Int |
Closed !ByteString !Fd |
CloseFailed !ByteString !Int |
Disconnected !ByteString !Fd |
MonitorStopped !ByteString !Int |

#### Instances

Instances details

Show EventMsg Source # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> EventMsg -> ShowS Source # show :: EventMsg -> String Source # showList :: [EventMsg] -> ShowS Source #
Eq EventMsg Source # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: EventMsg -> EventMsg -> Bool Source # (/=) :: EventMsg -> EventMsg -> Bool Source #

data Poll (s :: Type -> Type) (m :: Type -> Type) where Source #

A `Poll` value contains the object to poll (a 0MQ socket or a file descriptor), the set of `Event`s which are of interest and--optionally-- a callback-function which is invoked iff the set of interested events overlaps with the actual events.

Constructors

Sock :: forall (s :: Type -> Type) t (m :: Type -> Type). s t -> [Event] -> Maybe ([Event] -> m ()) -> Poll s m |
File :: forall (m :: Type -> Type) (s :: Type -> Type). Fd -> [Event] -> Maybe ([Event] -> m ()) -> Poll s m |

data KeyFormat a where Source #

Constructors

BinaryFormat :: KeyFormat Div4 |
TextFormat :: KeyFormat Div5 |

#### Instances

Instances details

Show (KeyFormat a) Source # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> KeyFormat a -> ShowS Source # show :: KeyFormat a -> String Source # showList :: [KeyFormat a] -> ShowS Source #
Eq (KeyFormat a) Source # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: KeyFormat a -> KeyFormat a -> Bool Source # (/=) :: KeyFormat a -> KeyFormat a -> Bool Source #

data SecurityMechanism Source #

Constructors

Null |
Plain |
Curve |

#### Instances

Instances details

Show SecurityMechanism Source # |
Instance details Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> SecurityMechanism -> ShowS Source # show :: SecurityMechanism -> String Source # showList :: [SecurityMechanism] -> ShowS Source #
Eq SecurityMechanism Source # |
Instance details Defined in System.ZMQ4.Internal Methods (==) :: SecurityMechanism -> SecurityMechanism -> Bool Source # (/=) :: SecurityMechanism -> SecurityMechanism -> Bool Source #

## Socket type-classes

class SocketType a Source #

Socket types.

Minimal complete definition

zmqSocketType

#### Instances

Instances details

SocketType Dealer Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Dealer -> ZMQSocketType Source #
SocketType Pair Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pair -> ZMQSocketType Source #
SocketType Pub Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pub -> ZMQSocketType Source #
SocketType Pull Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pull -> ZMQSocketType Source #
SocketType Push Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Push -> ZMQSocketType Source #
SocketType Rep Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Rep -> ZMQSocketType Source #
SocketType Req Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Req -> ZMQSocketType Source #
SocketType Router Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Router -> ZMQSocketType Source #
SocketType Stream Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Stream -> ZMQSocketType Source #
SocketType Sub Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Sub -> ZMQSocketType Source #
SocketType XPub Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: XPub -> ZMQSocketType Source #
SocketType XSub Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: XSub -> ZMQSocketType Source #

class Sender a Source #

Sockets which can `send`.

#### Instances

Instances details

Sender Dealer Source # |
Instance details Defined in System.ZMQ4
Sender Pair Source # |
Instance details Defined in System.ZMQ4
Sender Pub Source # |
Instance details Defined in System.ZMQ4
Sender Push Source # |
Instance details Defined in System.ZMQ4
Sender Rep Source # |
Instance details Defined in System.ZMQ4
Sender Req Source # |
Instance details Defined in System.ZMQ4
Sender Router Source # |
Instance details Defined in System.ZMQ4
Sender Stream Source # |
Instance details Defined in System.ZMQ4
Sender XPub Source # |
Instance details Defined in System.ZMQ4
Sender XSub Source # |
Instance details Defined in System.ZMQ4

class Receiver a Source #

Sockets which can `receive`.

#### Instances

Instances details

Receiver Dealer Source # |
Instance details Defined in System.ZMQ4
Receiver Pair Source # |
Instance details Defined in System.ZMQ4
Receiver Pull Source # |
Instance details Defined in System.ZMQ4
Receiver Rep Source # |
Instance details Defined in System.ZMQ4
Receiver Req Source # |
Instance details Defined in System.ZMQ4
Receiver Router Source # |
Instance details Defined in System.ZMQ4
Receiver Stream Source # |
Instance details Defined in System.ZMQ4
Receiver Sub Source # |
Instance details Defined in System.ZMQ4
Receiver XPub Source # |
Instance details Defined in System.ZMQ4
Receiver XSub Source # |
Instance details Defined in System.ZMQ4

class Subscriber a Source #

Sockets which can `subscribe`.

#### Instances

Instances details

Subscriber Sub Source # |
Instance details Defined in System.ZMQ4

class SocketLike (s :: Type -> Type) Source #

Minimal complete definition

toSocket

#### Instances

Instances details

SocketLike Socket Source # |
Instance details Defined in System.ZMQ4.Internal Methods toSocket :: Socket t -> Socket t Source #
SocketLike (Socket z) Source # |
Instance details Defined in System.ZMQ4.Monadic Methods toSocket :: Socket z t -> Socket t Source #

class Conflatable a Source #

Sockets which can be `conflate`d.

#### Instances

Instances details

Conflatable Dealer Source # |
Instance details Defined in System.ZMQ4
Conflatable Pub Source # |
Instance details Defined in System.ZMQ4
Conflatable Pull Source # |
Instance details Defined in System.ZMQ4
Conflatable Push Source # |
Instance details Defined in System.ZMQ4
Conflatable Sub Source # |
Instance details Defined in System.ZMQ4

class SendProbe a Source #

Sockets which can send probes (cf. `setProbeRouter`).

#### Instances

Instances details

SendProbe Dealer Source # |
Instance details Defined in System.ZMQ4
SendProbe Req Source # |
Instance details Defined in System.ZMQ4
SendProbe Router Source # |
Instance details Defined in System.ZMQ4

## Socket Types

data Pair Source #

ZMQ_PAIR

Constructors

Pair |

#### Instances

Instances details

Generic Pair Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Pair |
Instance details Defined in System.ZMQ4 type Rep Pair = D1 ('MetaData "Pair" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Pair" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Pair -> Rep Pair x Source #

to :: Rep Pair x -> Pair Source #

Eq Pair Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Pair -> Pair -> Bool Source # (/=) :: Pair -> Pair -> Bool Source #
Receiver Pair Source # |
Instance details Defined in System.ZMQ4
Sender Pair Source # |
Instance details Defined in System.ZMQ4
SocketType Pair Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pair -> ZMQSocketType Source #
type Rep Pair Source # |
Instance details Defined in System.ZMQ4 type Rep Pair = D1 ('MetaData "Pair" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Pair" 'PrefixI 'False) (U1 :: Type -> Type))

data Pub Source #

ZMQ_PUB

Constructors

Pub |

#### Instances

Instances details

Generic Pub Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Pub |
Instance details Defined in System.ZMQ4 type Rep Pub = D1 ('MetaData "Pub" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Pub" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Pub -> Rep Pub x Source #

to :: Rep Pub x -> Pub Source #

Eq Pub Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Pub -> Pub -> Bool Source # (/=) :: Pub -> Pub -> Bool Source #
Conflatable Pub Source # |
Instance details Defined in System.ZMQ4
Sender Pub Source # |
Instance details Defined in System.ZMQ4
SocketType Pub Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pub -> ZMQSocketType Source #
type Rep Pub Source # |
Instance details Defined in System.ZMQ4 type Rep Pub = D1 ('MetaData "Pub" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Pub" 'PrefixI 'False) (U1 :: Type -> Type))

data Sub Source #

ZMQ_SUB

Constructors

Sub |

#### Instances

Instances details

Generic Sub Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Sub |
Instance details Defined in System.ZMQ4 type Rep Sub = D1 ('MetaData "Sub" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Sub" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Sub -> Rep Sub x Source #

to :: Rep Sub x -> Sub Source #

Eq Sub Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Sub -> Sub -> Bool Source # (/=) :: Sub -> Sub -> Bool Source #
Conflatable Sub Source # |
Instance details Defined in System.ZMQ4
Receiver Sub Source # |
Instance details Defined in System.ZMQ4
Subscriber Sub Source # |
Instance details Defined in System.ZMQ4
SocketType Sub Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Sub -> ZMQSocketType Source #
type Rep Sub Source # |
Instance details Defined in System.ZMQ4 type Rep Sub = D1 ('MetaData "Sub" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Sub" 'PrefixI 'False) (U1 :: Type -> Type))

data XPub Source #

ZMQ_XPUB

Constructors

XPub |

#### Instances

Instances details

Generic XPub Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep XPub |
Instance details Defined in System.ZMQ4 type Rep XPub = D1 ('MetaData "XPub" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "XPub" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: XPub -> Rep XPub x Source #

to :: Rep XPub x -> XPub Source #

Eq XPub Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: XPub -> XPub -> Bool Source # (/=) :: XPub -> XPub -> Bool Source #
Receiver XPub Source # |
Instance details Defined in System.ZMQ4
Sender XPub Source # |
Instance details Defined in System.ZMQ4
SocketType XPub Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: XPub -> ZMQSocketType Source #
type Rep XPub Source # |
Instance details Defined in System.ZMQ4 type Rep XPub = D1 ('MetaData "XPub" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "XPub" 'PrefixI 'False) (U1 :: Type -> Type))

data XSub Source #

ZMQ_XSUB

Constructors

XSub |

#### Instances

Instances details

Generic XSub Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep XSub |
Instance details Defined in System.ZMQ4 type Rep XSub = D1 ('MetaData "XSub" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "XSub" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: XSub -> Rep XSub x Source #

to :: Rep XSub x -> XSub Source #

Eq XSub Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: XSub -> XSub -> Bool Source # (/=) :: XSub -> XSub -> Bool Source #
Receiver XSub Source # |
Instance details Defined in System.ZMQ4
Sender XSub Source # |
Instance details Defined in System.ZMQ4
SocketType XSub Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: XSub -> ZMQSocketType Source #
type Rep XSub Source # |
Instance details Defined in System.ZMQ4 type Rep XSub = D1 ('MetaData "XSub" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "XSub" 'PrefixI 'False) (U1 :: Type -> Type))

data Req Source #

ZMQ_REQ

Constructors

Req |

#### Instances

Instances details

Generic Req Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Req |
Instance details Defined in System.ZMQ4 type Rep Req = D1 ('MetaData "Req" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Req" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Req -> Rep Req x Source #

to :: Rep Req x -> Req Source #

Eq Req Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Req -> Req -> Bool Source # (/=) :: Req -> Req -> Bool Source #
Receiver Req Source # |
Instance details Defined in System.ZMQ4
SendProbe Req Source # |
Instance details Defined in System.ZMQ4
Sender Req Source # |
Instance details Defined in System.ZMQ4
SocketType Req Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Req -> ZMQSocketType Source #
type Rep Req Source # |
Instance details Defined in System.ZMQ4 type Rep Req = D1 ('MetaData "Req" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Req" 'PrefixI 'False) (U1 :: Type -> Type))

data Rep Source #

ZMQ_REP

Constructors

Rep |

#### Instances

Instances details

Generic Rep Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Rep |
Instance details Defined in System.ZMQ4 type Rep Rep = D1 ('MetaData "Rep" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Rep" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Rep -> Rep Rep x Source #

to :: Rep Rep x -> Rep Source #

Eq Rep Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Rep -> Rep -> Bool Source # (/=) :: Rep -> Rep -> Bool Source #
Receiver Rep Source # |
Instance details Defined in System.ZMQ4
Sender Rep Source # |
Instance details Defined in System.ZMQ4
SocketType Rep Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Rep -> ZMQSocketType Source #
type Rep Rep Source # |
Instance details Defined in System.ZMQ4 type Rep Rep = D1 ('MetaData "Rep" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Rep" 'PrefixI 'False) (U1 :: Type -> Type))

data Dealer Source #

ZMQ_DEALER

Constructors

Dealer |

#### Instances

Instances details

Generic Dealer Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Dealer |
Instance details Defined in System.ZMQ4 type Rep Dealer = D1 ('MetaData "Dealer" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Dealer" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Dealer -> Rep Dealer x Source #

to :: Rep Dealer x -> Dealer Source #

Eq Dealer Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Dealer -> Dealer -> Bool Source # (/=) :: Dealer -> Dealer -> Bool Source #
Conflatable Dealer Source # |
Instance details Defined in System.ZMQ4
Receiver Dealer Source # |
Instance details Defined in System.ZMQ4
SendProbe Dealer Source # |
Instance details Defined in System.ZMQ4
Sender Dealer Source # |
Instance details Defined in System.ZMQ4
SocketType Dealer Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Dealer -> ZMQSocketType Source #
type Rep Dealer Source # |
Instance details Defined in System.ZMQ4 type Rep Dealer = D1 ('MetaData "Dealer" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Dealer" 'PrefixI 'False) (U1 :: Type -> Type))

data Router Source #

ZMQ_ROUTER

Constructors

Router |

#### Instances

Instances details

Generic Router Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Router |
Instance details Defined in System.ZMQ4 type Rep Router = D1 ('MetaData "Router" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Router" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Router -> Rep Router x Source #

to :: Rep Router x -> Router Source #

Eq Router Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Router -> Router -> Bool Source # (/=) :: Router -> Router -> Bool Source #
Receiver Router Source # |
Instance details Defined in System.ZMQ4
SendProbe Router Source # |
Instance details Defined in System.ZMQ4
Sender Router Source # |
Instance details Defined in System.ZMQ4
SocketType Router Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Router -> ZMQSocketType Source #
type Rep Router Source # |
Instance details Defined in System.ZMQ4 type Rep Router = D1 ('MetaData "Router" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Router" 'PrefixI 'False) (U1 :: Type -> Type))

data Pull Source #

ZMQ_PULL

Constructors

Pull |

#### Instances

Instances details

Generic Pull Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Pull |
Instance details Defined in System.ZMQ4 type Rep Pull = D1 ('MetaData "Pull" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Pull" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Pull -> Rep Pull x Source #

to :: Rep Pull x -> Pull Source #

Eq Pull Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Pull -> Pull -> Bool Source # (/=) :: Pull -> Pull -> Bool Source #
Conflatable Pull Source # |
Instance details Defined in System.ZMQ4
Receiver Pull Source # |
Instance details Defined in System.ZMQ4
SocketType Pull Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Pull -> ZMQSocketType Source #
type Rep Pull Source # |
Instance details Defined in System.ZMQ4 type Rep Pull = D1 ('MetaData "Pull" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Pull" 'PrefixI 'False) (U1 :: Type -> Type))

data Push Source #

ZMQ_PUSH

Constructors

Push |

#### Instances

Instances details

Generic Push Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Push |
Instance details Defined in System.ZMQ4 type Rep Push = D1 ('MetaData "Push" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Push" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Push -> Rep Push x Source #

to :: Rep Push x -> Push Source #

Eq Push Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Push -> Push -> Bool Source # (/=) :: Push -> Push -> Bool Source #
Conflatable Push Source # |
Instance details Defined in System.ZMQ4
Sender Push Source # |
Instance details Defined in System.ZMQ4
SocketType Push Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Push -> ZMQSocketType Source #
type Rep Push Source # |
Instance details Defined in System.ZMQ4 type Rep Push = D1 ('MetaData "Push" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Push" 'PrefixI 'False) (U1 :: Type -> Type))

data Stream Source #

ZMQ_STREAM

Constructors

Stream |

#### Instances

Instances details

Generic Stream Source # |

Instance details

Defined in System.ZMQ4

Associated Types

type Rep Stream |
Instance details Defined in System.ZMQ4 type Rep Stream = D1 ('MetaData "Stream" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Stream" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: Stream -> Rep Stream x Source #

to :: Rep Stream x -> Stream Source #

Eq Stream Source # |
Instance details Defined in System.ZMQ4 Methods (==) :: Stream -> Stream -> Bool Source # (/=) :: Stream -> Stream -> Bool Source #
Receiver Stream Source # |
Instance details Defined in System.ZMQ4
Sender Stream Source # |
Instance details Defined in System.ZMQ4
SocketType Stream Source # |
Instance details Defined in System.ZMQ4 Methods zmqSocketType :: Stream -> ZMQSocketType Source #
type Rep Stream Source # |
Instance details Defined in System.ZMQ4 type Rep Stream = D1 ('MetaData "Stream" "System.ZMQ4" "zeromq4-haskell-0.8.0-9TA86NO6k841oWdJZTSR1" 'False) (C1 ('MetaCons "Stream" 'PrefixI 'False) (U1 :: Type -> Type))

# General Operations

version :: ZMQ z (Int, Int, Int) Source #

runZMQ :: MonadIO m => (forall z. ZMQ z a) -> m a Source #

Return the value computed by the given `ZMQ` monad. Rank-2 polymorphism is used to prevent leaking of `z`. An invocation of `runZMQ` will internally create a `Context` and all actions are executed relative to this context. On finish the context will be disposed, but see `async`.

async :: ZMQ z a -> ZMQ z (Async a) Source #

Run the given `ZMQ` computation asynchronously, i.e. this function runs the computation in a new thread using `async`. N.B. reference counting is used to prolong the lifetime of the `Context` encapsulated in `ZMQ` as necessary, e.g.:

    runZMQ $ do
        s <- socket Pair
        async $ do
            liftIO (threadDelay 10000000)
            identity s >>= liftIO . print

Here, `runZMQ` will finish before the code section in `async`, but due to reference counting, the `Context` will only be disposed after `async` finishes as well.

socket :: SocketType t => t -> ZMQ z (Socket z t) Source #

# ZMQ Options (Read)

ioThreads :: ZMQ z Word Source #

maxSockets :: ZMQ z Word Source #

# ZMQ Options (Write)

setIoThreads :: Word -> ZMQ z () Source #

setMaxSockets :: Word -> ZMQ z () Source #

# Socket operations

close :: Socket z t -> ZMQ z () Source #

bind :: Socket z t -> String -> ZMQ z () Source #

unbind :: Socket z t -> String -> ZMQ z () Source #

connect :: Socket z t -> String -> ZMQ z () Source #

disconnect :: Socket z t -> String -> ZMQ z () Source #

send :: Sender t => Socket z t -> [Flag] -> ByteString -> ZMQ z () Source #

send' :: Sender t => Socket z t -> [Flag] -> ByteString -> ZMQ z () Source #

sendMulti :: Sender t => Socket z t -> NonEmpty ByteString -> ZMQ z () Source #

receive :: Receiver t => Socket z t -> ZMQ z ByteString Source #

receiveMulti :: Receiver t => Socket z t -> ZMQ z [ByteString] Source #

subscribe :: Subscriber t => Socket z t -> ByteString -> ZMQ z () Source #

unsubscribe :: Subscriber t => Socket z t -> ByteString -> ZMQ z () Source #

proxy :: Socket z a -> Socket z b -> Maybe (Socket z c) -> ZMQ z () Source #

monitor :: [EventType] -> Socket z t -> ZMQ z (Bool -> IO (Maybe EventMsg)) Source #

socketMonitor :: [EventType] -> String -> Socket z t -> ZMQ z () Source #

poll :: forall (s :: Type -> Type) m. (SocketLike s, MonadIO m) => Timeout -> [Poll s m] -> m [[Event]] Source #

Polls for events on the given `Poll` descriptors. Returns a list of events per descriptor which have occured. (cf. zmq_poll)

# Socket Options (Read)

affinity :: Socket z t -> ZMQ z Word64 Source #

backlog :: Socket z t -> ZMQ z Int Source #

conflate :: Conflatable t => Socket z t -> ZMQ z Bool Source #

curvePublicKey :: KeyFormat f -> Socket z t -> ZMQ z ByteString Source #

curveSecretKey :: KeyFormat f -> Socket z t -> ZMQ z ByteString Source #

curveServerKey :: KeyFormat f -> Socket z t -> ZMQ z ByteString Source #

delayAttachOnConnect :: Socket z t -> ZMQ z Bool Source #

Deprecated: Use immediate

events :: Socket z t -> ZMQ z [Event] Source #

fileDescriptor :: Socket z t -> ZMQ z Fd Source #

identity :: Socket z t -> ZMQ z ByteString Source #

immediate :: Socket z t -> ZMQ z Bool Source #

ipv4Only :: Socket z t -> ZMQ z Bool Source #

Deprecated: Use ipv6

ipv6 :: Socket z t -> ZMQ z Bool Source #

lastEndpoint :: Socket z t -> ZMQ z String Source #

linger :: Socket z t -> ZMQ z Int Source #

maxMessageSize :: Socket z t -> ZMQ z Int64 Source #

mcastHops :: Socket z t -> ZMQ z Int Source #

mechanism :: Socket z t -> ZMQ z SecurityMechanism Source #

moreToReceive :: Socket z t -> ZMQ z Bool Source #

plainServer :: Socket z t -> ZMQ z Bool Source #

plainPassword :: Socket z t -> ZMQ z ByteString Source #

plainUserName :: Socket z t -> ZMQ z ByteString Source #

rate :: Socket z t -> ZMQ z Int Source #

receiveBuffer :: Socket z t -> ZMQ z Int Source #

receiveHighWM :: Socket z t -> ZMQ z Int Source #

receiveTimeout :: Socket z t -> ZMQ z Int Source #

reconnectInterval :: Socket z t -> ZMQ z Int Source #

reconnectIntervalMax :: Socket z t -> ZMQ z Int Source #

recoveryInterval :: Socket z t -> ZMQ z Int Source #

sendBuffer :: Socket z t -> ZMQ z Int Source #

sendHighWM :: Socket z t -> ZMQ z Int Source #

sendTimeout :: Socket z t -> ZMQ z Int Source #

tcpKeepAlive :: Socket z t -> ZMQ z Switch Source #

tcpKeepAliveCount :: Socket z t -> ZMQ z Int Source #

tcpKeepAliveIdle :: Socket z t -> ZMQ z Int Source #

tcpKeepAliveInterval :: Socket z t -> ZMQ z Int Source #

zapDomain :: Socket z t -> ZMQ z ByteString Source #

# Socket Options (Write)

setAffinity :: Word64 -> Socket z t -> ZMQ z () Source #

setBacklog :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z () Source #

setConflate :: Conflatable t => Bool -> Socket z t -> ZMQ z () Source #

setCurveServer :: Bool -> Socket z t -> ZMQ z () Source #

setCurvePublicKey :: KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z () Source #

setCurveSecretKey :: KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z () Source #

setCurveServerKey :: KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z () Source #

setDelayAttachOnConnect :: Bool -> Socket z t -> ZMQ z () Source #

Deprecated: Use setImmediate

setIdentity :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z () Source #

setImmediate :: Bool -> Socket z t -> ZMQ z () Source #

setIpv4Only :: Bool -> Socket z t -> ZMQ z () Source #

Deprecated: Use setIpv6

setIpv6 :: Bool -> Socket z t -> ZMQ z () Source #

setLinger :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z () Source #

setMaxMessageSize :: Integral i => Restricted (Nneg1, Int64) i -> Socket z t -> ZMQ z () Source #

setMcastHops :: Integral i => Restricted (N1, Int32) i -> Socket z t -> ZMQ z () Source #

setPlainServer :: Bool -> Socket z t -> ZMQ z () Source #

setPlainPassword :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z () Source #

setPlainUserName :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z () Source #

setProbeRouter :: SendProbe t => Bool -> Socket z t -> ZMQ z () Source #

setRate :: Integral i => Restricted (N1, Int32) i -> Socket z t -> ZMQ z () Source #

setReceiveBuffer :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z () Source #

setReceiveHighWM :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z () Source #

setReceiveTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z () Source #

setReconnectInterval :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z () Source #

setReconnectIntervalMax :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z () Source #

setRecoveryInterval :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z () Source #

setReqCorrelate :: Bool -> Socket z Req -> ZMQ z () Source #

setReqRelaxed :: Bool -> Socket z Req -> ZMQ z () Source #

setRouterMandatory :: Bool -> Socket z Router -> ZMQ z () Source #

setSendBuffer :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z () Source #

setSendHighWM :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z () Source #

setSendTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z () Source #

setTcpAcceptFilter :: Maybe ByteString -> Socket z t -> ZMQ z () Source #

setTcpKeepAlive :: Switch -> Socket z t -> ZMQ z () Source #

setTcpKeepAliveCount :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z () Source #

setTcpKeepAliveIdle :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z () Source #

setTcpKeepAliveInterval :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z () Source #

setXPubVerbose :: Bool -> Socket z XPub -> ZMQ z () Source #

setZapDomain :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z () Source #

# Error Handling

data ZMQError Source #

ZMQError encapsulates information about errors, which occur when using the native 0MQ API, such as error number and message.

#### Instances

Instances details

Exception ZMQError Source # |
Instance details Defined in System.ZMQ4.Internal.Error Methods toException :: ZMQError -> SomeException Source # fromException :: SomeException -> Maybe ZMQError Source # displayException :: ZMQError -> String Source # backtraceDesired :: ZMQError -> Bool Source #
Show ZMQError Source # |
Instance details Defined in System.ZMQ4.Internal.Error Methods showsPrec :: Int -> ZMQError -> ShowS Source # show :: ZMQError -> String Source # showList :: [ZMQError] -> ShowS Source #
Eq ZMQError Source # |
Instance details Defined in System.ZMQ4.Internal.Error Methods (==) :: ZMQError -> ZMQError -> Bool Source # (/=) :: ZMQError -> ZMQError -> Bool Source #
Ord ZMQError Source # |
Instance details Defined in System.ZMQ4.Internal.Error Methods compare :: ZMQError -> ZMQError -> Ordering Source # (<) :: ZMQError -> ZMQError -> Bool Source # (<=) :: ZMQError -> ZMQError -> Bool Source # (>) :: ZMQError -> ZMQError -> Bool Source # (>=) :: ZMQError -> ZMQError -> Bool Source # max :: ZMQError -> ZMQError -> ZMQError Source # min :: ZMQError -> ZMQError -> ZMQError Source #

errno :: ZMQError -> Int Source #

Error number value.

source :: ZMQError -> String Source #

Source where this error originates from.

message :: ZMQError -> String Source #

Actual error message.

# Re-exports

liftIO :: MonadIO m => IO a -> m a Source #

Lift a computation from the `IO` monad. This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations (i.e. `IO` is the base monad for the stack).

### Example

Expand

    import Control.Monad.Trans.State -- from the "transformers" library

    printState :: Show s => StateT s IO ()
    printState = do
      state <- get
      liftIO $ print state

Had we omitted ``liftIO``, we would have ended up with this error:

    • Couldn't match type ‘IO’ with ‘StateT s IO’
     Expected type: StateT s IO ()
       Actual type: IO ()

The important part here is the mismatch between `StateT s IO ()` and ``IO` ()`.

Luckily, we know of a function that takes an ``IO` a` and returns an `(m a)`: ``liftIO``, enabling us to run the program and see the expected results:

    > evalStateT printState "hello"
    "hello"

    > evalStateT printState 3
    3

restrict :: Restriction r v => v -> Restricted r v Source #

Create a restricted value. If the given value does not satisfy the restrictions, a modified variant is used instead, e.g. if an integer is larger than the upper bound, the upper bound value is used.

toRestricted :: Restriction r v => v -> Maybe (Restricted r v) Source #

Create a restricted value. Returns `Nothing` if the given value does not satisfy all restrictions.

# Low-level Functions

waitRead :: Socket z t -> ZMQ z () Source #

waitWrite :: Socket z t -> ZMQ z () Source #

z85Encode :: MonadIO m => Restricted Div4 ByteString -> m ByteString Source #

z85Decode :: MonadIO m => Restricted Div5 ByteString -> m ByteString Source #

curveKeyPair :: MonadIO m => m (Restricted Div5 ByteString, Restricted Div5 ByteString) Source #

Generate a new curve key pair. (cf. zmq_curve_keypair)