    {-# LANGUAGE RankNTypes                         #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving         #-}
    {-# LANGUAGE MultiParamTypeClasses              #-}
    {-# LANGUAGE TypeFamilies                       #-}
    {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}

    -- |
    -- Module      : System.ZMQ4.Monadic
    -- Copyright   : (c) 2013 Toralf Wittner
    -- License     : MIT
    -- Maintainer  : Toralf Wittner <tw@dtex.org>
    -- Stability   : experimental
    -- Portability : non-portable
    --
    -- This modules exposes a monadic interface of 'System.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'.
    module System.ZMQ4.Monadic
      ( -- * Type Definitions
        ZMQ
      , Socket
      , Z.Flag              (..)
      , Z.Switch            (..)
      , Z.Timeout
      , Z.Event             (..)
      , Z.EventType         (..)
      , Z.EventMsg          (..)
      , Z.Poll              (..)
      , Z.KeyFormat         (..)
      , Z.SecurityMechanism (..)

      -- ** Socket type-classes
      , Z.SocketType
      , Z.Sender
      , Z.Receiver
      , Z.Subscriber
      , Z.SocketLike
      , Z.Conflatable
      , Z.SendProbe

      -- ** Socket Types
      , Z.Pair   (..)
      , Z.Pub    (..)
      , Z.Sub    (..)
      , Z.XPub   (..)
      , Z.XSub   (..)
      , Z.Req    (..)
      , Z.Rep    (..)
      , Z.Dealer (..)
      , Z.Router (..)
      , Z.Pull   (..)
      , Z.Push   (..)
      , Z.Stream (..)

      -- * General Operations
      , version
      , runZMQ
      , async
      , socket

      -- * ZMQ Options (Read)
      , ioThreads
      , maxSockets

      -- * ZMQ Options (Write)
      , setIoThreads
      , setMaxSockets

      -- * Socket operations
      , close
      , bind
      , unbind
      , connect
      , disconnect
      , send
      , send'
      , sendMulti
      , receive
      , receiveMulti
      , subscribe
      , unsubscribe
      , proxy
      , monitor
      , socketMonitor
      , Z.poll

      -- * Socket Options (Read)
      , affinity
      , backlog
      , conflate
      , curvePublicKey
      , curveSecretKey
      , curveServerKey
      , delayAttachOnConnect
      , events
      , fileDescriptor
      , identity
      , immediate
      , ipv4Only
      , ipv6
      , lastEndpoint
      , linger
      , maxMessageSize
      , mcastHops
      , mechanism
      , moreToReceive
      , plainServer
      , plainPassword
      , plainUserName
      , rate
      , receiveBuffer
      , receiveHighWM
      , receiveTimeout
      , reconnectInterval
      , reconnectIntervalMax
      , recoveryInterval
      , sendBuffer
      , sendHighWM
      , sendTimeout
      , tcpKeepAlive
      , tcpKeepAliveCount
      , tcpKeepAliveIdle
      , tcpKeepAliveInterval
      , zapDomain

      -- * Socket Options (Write)
      , setAffinity
      , setBacklog
      , setConflate
      , setCurveServer
      , setCurvePublicKey
      , setCurveSecretKey
      , setCurveServerKey
      , setDelayAttachOnConnect
      , setIdentity
      , setImmediate
      , setIpv4Only
      , setIpv6
      , setLinger
      , setMaxMessageSize
      , setMcastHops
      , setPlainServer
      , setPlainPassword
      , setPlainUserName
      , setProbeRouter
      , setRate
      , setReceiveBuffer
      , setReceiveHighWM
      , setReceiveTimeout
      , setReconnectInterval
      , setReconnectIntervalMax
      , setRecoveryInterval
      , setReqCorrelate
      , setReqRelaxed
      , setRouterMandatory
      , setSendBuffer
      , setSendHighWM
      , setSendTimeout
      , setTcpAcceptFilter
      , setTcpKeepAlive
      , setTcpKeepAliveCount
      , setTcpKeepAliveIdle
      , setTcpKeepAliveInterval
      , setXPubVerbose
      , setZapDomain

      -- * Error Handling
      , Z.ZMQError
      , Z.errno
      , Z.source
      , Z.message

      -- * Re-exports
      , Control.Monad.IO.Class.liftIO
      , Data.Restricted.restrict
      , Data.Restricted.toRestricted

      -- * Low-level Functions
      , waitRead
      , waitWrite
      , I.z85Encode
      , I.z85Decode
      , Z.curveKeyPair
      ) where

    import Control.Applicative
    import Control.Concurrent.Async (Async)
    import Control.Monad
    import Control.Monad.Base (MonadBase(..))
    import Control.Monad.Catch
    import Control.Monad.IO.Class
    import Control.Monad.Trans.Control (MonadBaseControl(..))
    import Control.Monad.Trans.Reader
    import Data.Int
    import Data.IORef
    import Data.List.NonEmpty (NonEmpty)
    import Data.Restricted
    import Data.Word
    import Data.ByteString (ByteString)
    import System.Posix.Types (Fd)
    import Prelude

    import qualified Control.Concurrent.Async as A
    import qualified Control.Exception        as E
    import qualified Control.Monad.Catch      as C
    import qualified Data.ByteString.Lazy     as Lazy
    import qualified System.ZMQ4              as Z
    import qualified System.ZMQ4.Internal     as I

    data ZMQEnv = ZMQEnv
      { ZMQEnv -> IORef Word
    _refcount :: !(IORef Word)
      , ZMQEnv -> Context
    _context  :: !Z.Context
      , ZMQEnv -> IORef [SocketRepr]
    _sockets  :: !(IORef [I.SocketRepr])
      }

    -- | The ZMQ monad is modeled after 'Control.Monad.ST' and encapsulates
    -- a 'System.ZMQ4.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/.
    newtype ZMQ z a = ZMQ { forall z a. ZMQ z a -> ReaderT ZMQEnv IO a
    _unzmq :: ReaderT ZMQEnv IO a }
        deriving (MonadBase IO)

    -- | The ZMQ socket, parameterised by 'SocketType' and belonging to
    -- a particular 'ZMQ' thread.
    newtype Socket z t = Socket { forall z t. Socket z t -> Socket t
    _unsocket :: Z.Socket t }

    instance I.SocketLike (Socket z) where
        toSocket :: forall t. Socket z t -> Socket t
    toSocket = Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    instance Monad (ZMQ z) where
        return :: forall a. a -> ZMQ z a
    return = ReaderT ZMQEnv IO a -> ZMQ z a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ z a)
    -> (a -> ReaderT ZMQEnv IO a) -> a -> ZMQ z a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> ReaderT ZMQEnv IO a
    forall a. a -> ReaderT ZMQEnv IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return
        (ZMQ ReaderT ZMQEnv IO a
    m) >>= :: forall a b. ZMQ z a -> (a -> ZMQ z b) -> ZMQ z b
    >>= a -> ZMQ z b
    f = ReaderT ZMQEnv IO b -> ZMQ z b
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO b -> ZMQ z b) -> ReaderT ZMQEnv IO b -> ZMQ z b
    forall a b. (a -> b) -> a -> b
    $ ReaderT ZMQEnv IO a
    m ReaderT ZMQEnv IO a
    -> (a -> ReaderT ZMQEnv IO b) -> ReaderT ZMQEnv IO b
    forall a b.
    ReaderT ZMQEnv IO a
    -> (a -> ReaderT ZMQEnv IO b) -> ReaderT ZMQEnv IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= ZMQ z b -> ReaderT ZMQEnv IO b
    forall z a. ZMQ z a -> ReaderT ZMQEnv IO a
    _unzmq (ZMQ z b -> ReaderT ZMQEnv IO b)
    -> (a -> ZMQ z b) -> a -> ReaderT ZMQEnv IO b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> ZMQ z b
    f

    instance MonadIO (ZMQ z) where
        liftIO :: forall a. IO a -> ZMQ z a
    liftIO IO a
    m = ReaderT ZMQEnv IO a -> ZMQ z a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ z a) -> ReaderT ZMQEnv IO a -> ZMQ z a
    forall a b. (a -> b) -> a -> b
    $! IO a -> ReaderT ZMQEnv IO a
    forall a. IO a -> ReaderT ZMQEnv IO a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO IO a
    m

    instance MonadBaseControl IO (ZMQ z) where
        type StM (ZMQ z) a = a
        liftBaseWith :: forall a. (RunInBase (ZMQ z) IO -> IO a) -> ZMQ z a
    liftBaseWith = \RunInBase (ZMQ z) IO -> IO a
    f -> ReaderT ZMQEnv IO a -> ZMQ z a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ z a) -> ReaderT ZMQEnv IO a -> ZMQ z a
    forall a b. (a -> b) -> a -> b
    $ (RunInBase (ReaderT ZMQEnv IO) IO -> IO a) -> ReaderT ZMQEnv IO a
    forall a.
    (RunInBase (ReaderT ZMQEnv IO) IO -> IO a) -> ReaderT ZMQEnv IO a
    forall (b :: * -> *) (m :: * -> *) a.
    MonadBaseControl b m =>
    (RunInBase m b -> b a) -> m a
    liftBaseWith ((RunInBase (ReaderT ZMQEnv IO) IO -> IO a) -> ReaderT ZMQEnv IO a)
    -> (RunInBase (ReaderT ZMQEnv IO) IO -> IO a)
    -> ReaderT ZMQEnv IO a
    forall a b. (a -> b) -> a -> b
    $ \RunInBase (ReaderT ZMQEnv IO) IO
    q -> RunInBase (ZMQ z) IO -> IO a
    f (ReaderT ZMQEnv IO a -> IO a
    ReaderT ZMQEnv IO a -> IO (StM (ReaderT ZMQEnv IO) a)
    RunInBase (ReaderT ZMQEnv IO) IO
    q (ReaderT ZMQEnv IO a -> IO a)
    -> (ZMQ z a -> ReaderT ZMQEnv IO a) -> ZMQ z a -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ZMQ z a -> ReaderT ZMQEnv IO a
    forall z a. ZMQ z a -> ReaderT ZMQEnv IO a
    _unzmq)
        restoreM :: forall a. StM (ZMQ z) a -> ZMQ z a
    restoreM = ReaderT ZMQEnv IO a -> ZMQ z a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ z a)
    -> (a -> ReaderT ZMQEnv IO a) -> a -> ZMQ z a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> ReaderT ZMQEnv IO a
    StM (ReaderT ZMQEnv IO) a -> ReaderT ZMQEnv IO a
    forall a. StM (ReaderT ZMQEnv IO) a -> ReaderT ZMQEnv IO a
    forall (b :: * -> *) (m :: * -> *) a.
    MonadBaseControl b m =>
    StM m a -> m a
    restoreM

    instance MonadThrow (ZMQ z) where
        throwM :: forall e a. (HasCallStack, Exception e) => e -> ZMQ z a
    throwM = ReaderT ZMQEnv IO a -> ZMQ z a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ z a)
    -> (e -> ReaderT ZMQEnv IO a) -> e -> ZMQ z a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . e -> ReaderT ZMQEnv IO a
    forall e a. (HasCallStack, Exception e) => e -> ReaderT ZMQEnv IO a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    C.throwM

    instance MonadCatch (ZMQ z) where
        catch :: forall e a.
    (HasCallStack, Exception e) =>
    ZMQ z a -> (e -> ZMQ z a) -> ZMQ z a
    catch (ZMQ ReaderT ZMQEnv IO a
    m) e -> ZMQ z a
    f = ReaderT ZMQEnv IO a -> ZMQ z a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ z a) -> ReaderT ZMQEnv IO a -> ZMQ z a
    forall a b. (a -> b) -> a -> b
    $ ReaderT ZMQEnv IO a
    m ReaderT ZMQEnv IO a
    -> (e -> ReaderT ZMQEnv IO a) -> ReaderT ZMQEnv IO a
    forall e a.
    (HasCallStack, Exception e) =>
    ReaderT ZMQEnv IO a
    -> (e -> ReaderT ZMQEnv IO a) -> ReaderT ZMQEnv IO a
    forall (m :: * -> *) e a.
    (MonadCatch m, HasCallStack, Exception e) =>
    m a -> (e -> m a) -> m a
    `C.catch` (ZMQ z a -> ReaderT ZMQEnv IO a
    forall z a. ZMQ z a -> ReaderT ZMQEnv IO a
    _unzmq (ZMQ z a -> ReaderT ZMQEnv IO a)
    -> (e -> ZMQ z a) -> e -> ReaderT ZMQEnv IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . e -> ZMQ z a
    f)

    instance MonadMask (ZMQ z) where
        mask :: forall b.
    HasCallStack =>
    ((forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b) -> ZMQ z b
    mask (forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b
    a = ReaderT ZMQEnv IO b -> ZMQ z b
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO b -> ZMQ z b)
    -> ((ZMQEnv -> IO b) -> ReaderT ZMQEnv IO b)
    -> (ZMQEnv -> IO b)
    -> ZMQ z b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (ZMQEnv -> IO b) -> ReaderT ZMQEnv IO b
    forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
    ReaderT ((ZMQEnv -> IO b) -> ZMQ z b) -> (ZMQEnv -> IO b) -> ZMQ z b
    forall a b. (a -> b) -> a -> b
    $ \ZMQEnv
    env ->
            ((forall a. IO a -> IO a) -> IO b) -> IO b
    forall b.
    HasCallStack =>
    ((forall a. IO a -> IO a) -> IO b) -> IO b
    forall (m :: * -> *) b.
    (MonadMask m, HasCallStack) =>
    ((forall a. m a -> m a) -> m b) -> m b
    C.mask (((forall a. IO a -> IO a) -> IO b) -> IO b)
    -> ((forall a. IO a -> IO a) -> IO b) -> IO b
    forall a b. (a -> b) -> a -> b
    $ \forall a. IO a -> IO a
    restore ->
                let f :: forall r a . ZMQ r a -> ZMQ r a
                    f :: forall r a. ZMQ r a -> ZMQ r a
    f (ZMQ (ReaderT ZMQEnv -> IO a
    b)) = ReaderT ZMQEnv IO a -> ZMQ r a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ r a) -> ReaderT ZMQEnv IO a -> ZMQ r a
    forall a b. (a -> b) -> a -> b
    $ (ZMQEnv -> IO a) -> ReaderT ZMQEnv IO a
    forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
    ReaderT (IO a -> IO a
    forall a. IO a -> IO a
    restore (IO a -> IO a) -> (ZMQEnv -> IO a) -> ZMQEnv -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ZMQEnv -> IO a
    b)
                in ReaderT ZMQEnv IO b -> ZMQEnv -> IO b
    forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
    runReaderT (ZMQ z b -> ReaderT ZMQEnv IO b
    forall z a. ZMQ z a -> ReaderT ZMQEnv IO a
    _unzmq ((forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b
    a ((forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b)
    -> (forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b
    forall a b. (a -> b) -> a -> b
    $ ZMQ z a -> ZMQ z a
    forall a. ZMQ z a -> ZMQ z a
    forall r a. ZMQ r a -> ZMQ r a
    f)) ZMQEnv
    env

        uninterruptibleMask :: forall b.
    HasCallStack =>
    ((forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b) -> ZMQ z b
    uninterruptibleMask (forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b
    a = ReaderT ZMQEnv IO b -> ZMQ z b
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO b -> ZMQ z b)
    -> ((ZMQEnv -> IO b) -> ReaderT ZMQEnv IO b)
    -> (ZMQEnv -> IO b)
    -> ZMQ z b
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (ZMQEnv -> IO b) -> ReaderT ZMQEnv IO b
    forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
    ReaderT ((ZMQEnv -> IO b) -> ZMQ z b) -> (ZMQEnv -> IO b) -> ZMQ z b
    forall a b. (a -> b) -> a -> b
    $ \ZMQEnv
    env ->
            ((forall a. IO a -> IO a) -> IO b) -> IO b
    forall b.
    HasCallStack =>
    ((forall a. IO a -> IO a) -> IO b) -> IO b
    forall (m :: * -> *) b.
    (MonadMask m, HasCallStack) =>
    ((forall a. m a -> m a) -> m b) -> m b
    C.uninterruptibleMask (((forall a. IO a -> IO a) -> IO b) -> IO b)
    -> ((forall a. IO a -> IO a) -> IO b) -> IO b
    forall a b. (a -> b) -> a -> b
    $ \forall a. IO a -> IO a
    restore ->
                let f :: forall r a . ZMQ r a -> ZMQ r a
                    f :: forall r a. ZMQ r a -> ZMQ r a
    f (ZMQ (ReaderT ZMQEnv -> IO a
    b)) = ReaderT ZMQEnv IO a -> ZMQ r a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ r a) -> ReaderT ZMQEnv IO a -> ZMQ r a
    forall a b. (a -> b) -> a -> b
    $ (ZMQEnv -> IO a) -> ReaderT ZMQEnv IO a
    forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a
    ReaderT (IO a -> IO a
    forall a. IO a -> IO a
    restore (IO a -> IO a) -> (ZMQEnv -> IO a) -> ZMQEnv -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ZMQEnv -> IO a
    b)
                in ReaderT ZMQEnv IO b -> ZMQEnv -> IO b
    forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
    runReaderT (ZMQ z b -> ReaderT ZMQEnv IO b
    forall z a. ZMQ z a -> ReaderT ZMQEnv IO a
    _unzmq ((forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b
    a ((forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b)
    -> (forall a. ZMQ z a -> ZMQ z a) -> ZMQ z b
    forall a b. (a -> b) -> a -> b
    $ ZMQ z a -> ZMQ z a
    forall a. ZMQ z a -> ZMQ z a
    forall r a. ZMQ r a -> ZMQ r a
    f)) ZMQEnv
    env

    instance Functor (ZMQ z) where
        fmap :: forall a b. (a -> b) -> ZMQ z a -> ZMQ z b
    fmap = (a -> b) -> ZMQ z a -> ZMQ z b
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM

    instance Applicative (ZMQ z) where
        pure :: forall a. a -> ZMQ z a
    pure  = a -> ZMQ z a
    forall a. a -> ZMQ z a
    forall (m :: * -> *) a. Monad m => a -> m a
    return
        <*> :: forall a b. ZMQ z (a -> b) -> ZMQ z a -> ZMQ z b
    (<*>) = ZMQ z (a -> b) -> ZMQ z a -> ZMQ z b
    forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
    ap

    -- | 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 'System.ZMQ4.Context'
    -- and all actions are executed relative to this context. On finish the
    -- context will be disposed, but see 'async'.
    runZMQ :: MonadIO m => (forall z. ZMQ z a) -> m a
    runZMQ :: forall (m :: * -> *) a. MonadIO m => (forall z. ZMQ z a) -> m a
    runZMQ forall z. ZMQ z a
    z = IO a -> m a
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO a -> m a) -> IO a -> m a
    forall a b. (a -> b) -> a -> b
    $ IO ZMQEnv -> (ZMQEnv -> IO ()) -> (ZMQEnv -> IO a) -> IO a
    forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
    E.bracket IO ZMQEnv
    make ZMQEnv -> IO ()
    term (ReaderT ZMQEnv IO a -> ZMQEnv -> IO a
    forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
    runReaderT (ZMQ (ZonkAny 0) a -> ReaderT ZMQEnv IO a
    forall z a. ZMQ z a -> ReaderT ZMQEnv IO a
    _unzmq ZMQ (ZonkAny 0) a
    forall z. ZMQ z a
    z))
      where
        make :: IO ZMQEnv
    make = IORef Word -> Context -> IORef [SocketRepr] -> ZMQEnv
    ZMQEnv (IORef Word -> Context -> IORef [SocketRepr] -> ZMQEnv)
    -> IO (IORef Word) -> IO (Context -> IORef [SocketRepr] -> ZMQEnv)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Word -> IO (IORef Word)
    forall a. a -> IO (IORef a)
    newIORef Word
    1 IO (Context -> IORef [SocketRepr] -> ZMQEnv)
    -> IO Context -> IO (IORef [SocketRepr] -> ZMQEnv)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> IO Context
    Z.context IO (IORef [SocketRepr] -> ZMQEnv)
    -> IO (IORef [SocketRepr]) -> IO ZMQEnv
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> [SocketRepr] -> IO (IORef [SocketRepr])
    forall a. a -> IO (IORef a)
    newIORef []

    -- | Run the given 'ZMQ' computation asynchronously, i.e. this function
    -- runs the computation in a new thread using 'Control.Concurrent.Async.async'.
    -- /N.B./ reference counting is used to prolong the lifetime of the
    -- 'System.ZMQ.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 'System.ZMQ4.Context' will only be disposed after
    -- 'async' finishes as well.
    async :: ZMQ z a -> ZMQ z (Async a)
    async :: forall z a. ZMQ z a -> ZMQ z (Async a)
    async ZMQ z a
    z = ReaderT ZMQEnv IO (Async a) -> ZMQ z (Async a)
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO (Async a) -> ZMQ z (Async a))
    -> ReaderT ZMQEnv IO (Async a) -> ZMQ z (Async a)
    forall a b. (a -> b) -> a -> b
    $ do
        e <- ReaderT ZMQEnv IO ZMQEnv
    forall (m :: * -> *) r. Monad m => ReaderT r m r
    ask
        liftIO $ atomicModifyIORef (_refcount e) $ \Word
    n -> (Word -> Word
    forall a. Enum a => a -> a
    succ Word
    n, ())
        liftIO . A.async $ (runReaderT (_unzmq z) e) `E.finally` term e

    ioThreads :: ZMQ z Word
    ioThreads :: forall z. ZMQ z Word
    ioThreads = (Context -> IO Word) -> ZMQ z Word
    forall a z. (Context -> IO a) -> ZMQ z a
    onContext Context -> IO Word
    Z.ioThreads

    setIoThreads :: Word -> ZMQ z ()
    setIoThreads :: forall z. Word -> ZMQ z ()
    setIoThreads = (Context -> IO ()) -> ZMQ z ()
    forall a z. (Context -> IO a) -> ZMQ z a
    onContext ((Context -> IO ()) -> ZMQ z ())
    -> (Word -> Context -> IO ()) -> Word -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word -> Context -> IO ()
    Z.setIoThreads

    maxSockets :: ZMQ z Word
    maxSockets :: forall z. ZMQ z Word
    maxSockets = (Context -> IO Word) -> ZMQ z Word
    forall a z. (Context -> IO a) -> ZMQ z a
    onContext Context -> IO Word
    Z.maxSockets

    setMaxSockets :: Word -> ZMQ z ()
    setMaxSockets :: forall z. Word -> ZMQ z ()
    setMaxSockets = (Context -> IO ()) -> ZMQ z ()
    forall a z. (Context -> IO a) -> ZMQ z a
    onContext ((Context -> IO ()) -> ZMQ z ())
    -> (Word -> Context -> IO ()) -> Word -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word -> Context -> IO ()
    Z.setMaxSockets

    socket :: Z.SocketType t => t -> ZMQ z (Socket z t)
    socket :: forall t z. SocketType t => t -> ZMQ z (Socket z t)
    socket t
    t = ReaderT ZMQEnv IO (Socket z t) -> ZMQ z (Socket z t)
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO (Socket z t) -> ZMQ z (Socket z t))
    -> ReaderT ZMQEnv IO (Socket z t) -> ZMQ z (Socket z t)
    forall a b. (a -> b) -> a -> b
    $ do
        c <- (ZMQEnv -> Context) -> ReaderT ZMQEnv IO Context
    forall (m :: * -> *) r a. Monad m => (r -> a) -> ReaderT r m a
    asks ZMQEnv -> Context
    _context
        s <- asks _sockets
        x <- liftIO $ I.mkSocketRepr t c
        liftIO $ atomicModifyIORef s $ \[SocketRepr]
    ss -> (SocketRepr
    xSocketRepr -> [SocketRepr] -> [SocketRepr]
    forall a. a -> [a] -> [a]
    :[SocketRepr]
    ss, ())
        return (Socket (I.Socket x))

    version :: ZMQ z (Int, Int, Int)
    version :: forall z. ZMQ z (Int, Int, Int)
    version = IO (Int, Int, Int) -> ZMQ z (Int, Int, Int)
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO (Int, Int, Int) -> ZMQ z (Int, Int, Int))
    -> IO (Int, Int, Int) -> ZMQ z (Int, Int, Int)
    forall a b. (a -> b) -> a -> b
    $! IO (Int, Int, Int)
    Z.version

    -- * Socket operations

    close :: Socket z t -> ZMQ z ()
    close :: forall z t. Socket z t -> ZMQ z ()
    close = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO ()
    forall a. Socket a -> IO ()
    Z.close (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    bind :: Socket z t -> String -> ZMQ z ()
    bind :: forall z t. Socket z t -> String -> ZMQ z ()
    bind Socket z t
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ()) -> (String -> IO ()) -> String -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> String -> IO ()
    forall a. Socket a -> String -> IO ()
    Z.bind (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    unbind :: Socket z t -> String -> ZMQ z ()
    unbind :: forall z t. Socket z t -> String -> ZMQ z ()
    unbind Socket z t
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ()) -> (String -> IO ()) -> String -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> String -> IO ()
    forall a. Socket a -> String -> IO ()
    Z.unbind (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    connect :: Socket z t -> String -> ZMQ z ()
    connect :: forall z t. Socket z t -> String -> ZMQ z ()
    connect Socket z t
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ()) -> (String -> IO ()) -> String -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> String -> IO ()
    forall a. Socket a -> String -> IO ()
    Z.connect (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    disconnect :: Socket z t -> String -> ZMQ z ()
    disconnect :: forall z t. Socket z t -> String -> ZMQ z ()
    disconnect Socket z t
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ()) -> (String -> IO ()) -> String -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> String -> IO ()
    forall a. Socket a -> String -> IO ()
    Z.disconnect (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    send :: Z.Sender t => Socket z t -> [Z.Flag] -> ByteString -> ZMQ z ()
    send :: forall t z.
    Sender t =>
    Socket z t -> [Flag] -> ByteString -> ZMQ z ()
    send Socket z t
    s [Flag]
    f = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (ByteString -> IO ()) -> ByteString -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> [Flag] -> ByteString -> IO ()
    forall a. Sender a => Socket a -> [Flag] -> ByteString -> IO ()
    Z.send (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s) [Flag]
    f

    send' :: Z.Sender t => Socket z t -> [Z.Flag] -> Lazy.ByteString -> ZMQ z ()
    send' :: forall t z.
    Sender t =>
    Socket z t -> [Flag] -> ByteString -> ZMQ z ()
    send' Socket z t
    s [Flag]
    f = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (ByteString -> IO ()) -> ByteString -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> [Flag] -> ByteString -> IO ()
    forall a. Sender a => Socket a -> [Flag] -> ByteString -> IO ()
    Z.send' (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s) [Flag]
    f

    sendMulti :: Z.Sender t => Socket z t -> NonEmpty ByteString -> ZMQ z ()
    sendMulti :: forall t z.
    Sender t =>
    Socket z t -> NonEmpty ByteString -> ZMQ z ()
    sendMulti Socket z t
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (NonEmpty ByteString -> IO ())
    -> NonEmpty ByteString
    -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> NonEmpty ByteString -> IO ()
    forall a. Sender a => Socket a -> NonEmpty ByteString -> IO ()
    Z.sendMulti (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    receive :: Z.Receiver t => Socket z t -> ZMQ z ByteString
    receive :: forall t z. Receiver t => Socket z t -> ZMQ z ByteString
    receive = IO ByteString -> ZMQ z ByteString
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO ByteString -> ZMQ z ByteString)
    -> (Socket z t -> IO ByteString) -> Socket z t -> ZMQ z ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO ByteString
    forall a. Receiver a => Socket a -> IO ByteString
    Z.receive (Socket t -> IO ByteString)
    -> (Socket z t -> Socket t) -> Socket z t -> IO ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    receiveMulti :: Z.Receiver t => Socket z t -> ZMQ z [ByteString]
    receiveMulti :: forall t z. Receiver t => Socket z t -> ZMQ z [ByteString]
    receiveMulti = IO [ByteString] -> ZMQ z [ByteString]
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO [ByteString] -> ZMQ z [ByteString])
    -> (Socket z t -> IO [ByteString])
    -> Socket z t
    -> ZMQ z [ByteString]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO [ByteString]
    forall a. Receiver a => Socket a -> IO [ByteString]
    Z.receiveMulti (Socket t -> IO [ByteString])
    -> (Socket z t -> Socket t) -> Socket z t -> IO [ByteString]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    subscribe :: Z.Subscriber t => Socket z t -> ByteString -> ZMQ z ()
    subscribe :: forall t z. Subscriber t => Socket z t -> ByteString -> ZMQ z ()
    subscribe Socket z t
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (ByteString -> IO ()) -> ByteString -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> ByteString -> IO ()
    forall a. Subscriber a => Socket a -> ByteString -> IO ()
    Z.subscribe (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    unsubscribe :: Z.Subscriber t => Socket z t -> ByteString -> ZMQ z ()
    unsubscribe :: forall t z. Subscriber t => Socket z t -> ByteString -> ZMQ z ()
    unsubscribe Socket z t
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (ByteString -> IO ()) -> ByteString -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> ByteString -> IO ()
    forall a. Subscriber a => Socket a -> ByteString -> IO ()
    Z.unsubscribe (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    proxy :: Socket z a -> Socket z b -> Maybe (Socket z c) -> ZMQ z ()
    proxy :: forall z a b c.
    Socket z a -> Socket z b -> Maybe (Socket z c) -> ZMQ z ()
    proxy Socket z a
    a Socket z b
    b Maybe (Socket z c)
    c = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ()) -> IO () -> ZMQ z ()
    forall a b. (a -> b) -> a -> b
    $ Socket a -> Socket b -> Maybe (Socket c) -> IO ()
    forall a b c. Socket a -> Socket b -> Maybe (Socket c) -> IO ()
    Z.proxy (Socket z a -> Socket a
    forall z t. Socket z t -> Socket t
    _unsocket Socket z a
    a) (Socket z b -> Socket b
    forall z t. Socket z t -> Socket t
    _unsocket Socket z b
    b) (Socket z c -> Socket c
    forall z t. Socket z t -> Socket t
    _unsocket (Socket z c -> Socket c) -> Maybe (Socket z c) -> Maybe (Socket c)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Maybe (Socket z c)
    c)

    monitor :: [Z.EventType] -> Socket z t -> ZMQ z (Bool -> IO (Maybe Z.EventMsg))
    monitor :: forall z t.
    [EventType] -> Socket z t -> ZMQ z (Bool -> IO (Maybe EventMsg))
    monitor [EventType]
    es Socket z t
    s = (Context -> IO (Bool -> IO (Maybe EventMsg)))
    -> ZMQ z (Bool -> IO (Maybe EventMsg))
    forall a z. (Context -> IO a) -> ZMQ z a
    onContext ((Context -> IO (Bool -> IO (Maybe EventMsg)))
     -> ZMQ z (Bool -> IO (Maybe EventMsg)))
    -> (Context -> IO (Bool -> IO (Maybe EventMsg)))
    -> ZMQ z (Bool -> IO (Maybe EventMsg))
    forall a b. (a -> b) -> a -> b
    $ \Context
    ctx -> [EventType]
    -> Context -> Socket t -> IO (Bool -> IO (Maybe EventMsg))
    forall a.
    [EventType]
    -> Context -> Socket a -> IO (Bool -> IO (Maybe EventMsg))
    Z.monitor [EventType]
    es Context
    ctx (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    socketMonitor :: [Z.EventType] -> String -> Socket z t -> ZMQ z ()
    socketMonitor :: forall z t. [EventType] -> String -> Socket z t -> ZMQ z ()
    socketMonitor [EventType]
    es String
    addr Socket z t
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ()) -> IO () -> ZMQ z ()
    forall a b. (a -> b) -> a -> b
    $ [EventType] -> String -> Socket t -> IO ()
    forall a. [EventType] -> String -> Socket a -> IO ()
    Z.socketMonitor [EventType]
    es String
    addr (Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket Socket z t
    s)

    -- * Socket Options (Read)

    affinity :: Socket z t -> ZMQ z Word64
    affinity :: forall z t. Socket z t -> ZMQ z Word64
    affinity = IO Word64 -> ZMQ z Word64
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Word64 -> ZMQ z Word64)
    -> (Socket z t -> IO Word64) -> Socket z t -> ZMQ z Word64
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Word64
    forall a. Socket a -> IO Word64
    Z.affinity (Socket t -> IO Word64)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Word64
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    backlog :: Socket z t -> ZMQ z Int
    backlog :: forall z t. Socket z t -> ZMQ z Int
    backlog = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.backlog (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    conflate :: Z.Conflatable t => Socket z t -> ZMQ z Bool
    conflate :: forall t z. Conflatable t => Socket z t -> ZMQ z Bool
    conflate = IO Bool -> ZMQ z Bool
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bool -> ZMQ z Bool)
    -> (Socket z t -> IO Bool) -> Socket z t -> ZMQ z Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Bool
    forall a. Conflatable a => Socket a -> IO Bool
    Z.conflate (Socket t -> IO Bool)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    curvePublicKey :: Z.KeyFormat f -> Socket z t -> ZMQ z ByteString
    curvePublicKey :: forall f z t. KeyFormat f -> Socket z t -> ZMQ z ByteString
    curvePublicKey KeyFormat f
    f = IO ByteString -> ZMQ z ByteString
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO ByteString -> ZMQ z ByteString)
    -> (Socket z t -> IO ByteString) -> Socket z t -> ZMQ z ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . KeyFormat f -> Socket t -> IO ByteString
    forall f a. KeyFormat f -> Socket a -> IO ByteString
    Z.curvePublicKey KeyFormat f
    f (Socket t -> IO ByteString)
    -> (Socket z t -> Socket t) -> Socket z t -> IO ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    curveSecretKey :: Z.KeyFormat f -> Socket z t -> ZMQ z ByteString
    curveSecretKey :: forall f z t. KeyFormat f -> Socket z t -> ZMQ z ByteString
    curveSecretKey KeyFormat f
    f = IO ByteString -> ZMQ z ByteString
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO ByteString -> ZMQ z ByteString)
    -> (Socket z t -> IO ByteString) -> Socket z t -> ZMQ z ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . KeyFormat f -> Socket t -> IO ByteString
    forall f a. KeyFormat f -> Socket a -> IO ByteString
    Z.curveSecretKey KeyFormat f
    f (Socket t -> IO ByteString)
    -> (Socket z t -> Socket t) -> Socket z t -> IO ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    curveServerKey :: Z.KeyFormat f -> Socket z t -> ZMQ z ByteString
    curveServerKey :: forall f z t. KeyFormat f -> Socket z t -> ZMQ z ByteString
    curveServerKey KeyFormat f
    f = IO ByteString -> ZMQ z ByteString
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO ByteString -> ZMQ z ByteString)
    -> (Socket z t -> IO ByteString) -> Socket z t -> ZMQ z ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . KeyFormat f -> Socket t -> IO ByteString
    forall f a. KeyFormat f -> Socket a -> IO ByteString
    Z.curveServerKey KeyFormat f
    f (Socket t -> IO ByteString)
    -> (Socket z t -> Socket t) -> Socket z t -> IO ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    delayAttachOnConnect :: Socket z t -> ZMQ z Bool
    delayAttachOnConnect :: forall z t. Socket z t -> ZMQ z Bool
    delayAttachOnConnect = IO Bool -> ZMQ z Bool
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bool -> ZMQ z Bool)
    -> (Socket z t -> IO Bool) -> Socket z t -> ZMQ z Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Bool
    forall a. Socket a -> IO Bool
    Z.delayAttachOnConnect (Socket t -> IO Bool)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket
    {-# DEPRECATED delayAttachOnConnect "Use immediate" #-}

    events :: Socket z t -> ZMQ z [Z.Event]
    events :: forall z t. Socket z t -> ZMQ z [Event]
    events = IO [Event] -> ZMQ z [Event]
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO [Event] -> ZMQ z [Event])
    -> (Socket z t -> IO [Event]) -> Socket z t -> ZMQ z [Event]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO [Event]
    forall a. Socket a -> IO [Event]
    Z.events (Socket t -> IO [Event])
    -> (Socket z t -> Socket t) -> Socket z t -> IO [Event]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    fileDescriptor :: Socket z t -> ZMQ z Fd
    fileDescriptor :: forall z t. Socket z t -> ZMQ z Fd
    fileDescriptor = IO Fd -> ZMQ z Fd
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Fd -> ZMQ z Fd)
    -> (Socket z t -> IO Fd) -> Socket z t -> ZMQ z Fd
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Fd
    forall a. Socket a -> IO Fd
    Z.fileDescriptor (Socket t -> IO Fd)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Fd
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    identity :: Socket z t -> ZMQ z ByteString
    identity :: forall z t. Socket z t -> ZMQ z ByteString
    identity = IO ByteString -> ZMQ z ByteString
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO ByteString -> ZMQ z ByteString)
    -> (Socket z t -> IO ByteString) -> Socket z t -> ZMQ z ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO ByteString
    forall a. Socket a -> IO ByteString
    Z.identity (Socket t -> IO ByteString)
    -> (Socket z t -> Socket t) -> Socket z t -> IO ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    immediate :: Socket z t -> ZMQ z Bool
    immediate :: forall z t. Socket z t -> ZMQ z Bool
    immediate = IO Bool -> ZMQ z Bool
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bool -> ZMQ z Bool)
    -> (Socket z t -> IO Bool) -> Socket z t -> ZMQ z Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Bool
    forall a. Socket a -> IO Bool
    Z.immediate (Socket t -> IO Bool)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    ipv4Only :: Socket z t -> ZMQ z Bool
    ipv4Only :: forall z t. Socket z t -> ZMQ z Bool
    ipv4Only = IO Bool -> ZMQ z Bool
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bool -> ZMQ z Bool)
    -> (Socket z t -> IO Bool) -> Socket z t -> ZMQ z Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Bool
    forall a. Socket a -> IO Bool
    Z.ipv4Only (Socket t -> IO Bool)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket
    {-# DEPRECATED ipv4Only "Use ipv6" #-}

    ipv6 :: Socket z t -> ZMQ z Bool
    ipv6 :: forall z t. Socket z t -> ZMQ z Bool
    ipv6 = IO Bool -> ZMQ z Bool
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bool -> ZMQ z Bool)
    -> (Socket z t -> IO Bool) -> Socket z t -> ZMQ z Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Bool
    forall a. Socket a -> IO Bool
    Z.ipv6 (Socket t -> IO Bool)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    lastEndpoint :: Socket z t -> ZMQ z String
    lastEndpoint :: forall z t. Socket z t -> ZMQ z String
    lastEndpoint = IO String -> ZMQ z String
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO String -> ZMQ z String)
    -> (Socket z t -> IO String) -> Socket z t -> ZMQ z String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO String
    forall a. Socket a -> IO String
    Z.lastEndpoint (Socket t -> IO String)
    -> (Socket z t -> Socket t) -> Socket z t -> IO String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    linger :: Socket z t -> ZMQ z Int
    linger :: forall z t. Socket z t -> ZMQ z Int
    linger = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.linger (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    maxMessageSize :: Socket z t -> ZMQ z Int64
    maxMessageSize :: forall z t. Socket z t -> ZMQ z Int64
    maxMessageSize = IO Int64 -> ZMQ z Int64
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int64 -> ZMQ z Int64)
    -> (Socket z t -> IO Int64) -> Socket z t -> ZMQ z Int64
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int64
    forall a. Socket a -> IO Int64
    Z.maxMessageSize (Socket t -> IO Int64)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int64
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    mcastHops :: Socket z t -> ZMQ z Int
    mcastHops :: forall z t. Socket z t -> ZMQ z Int
    mcastHops = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.mcastHops (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    mechanism :: Socket z t -> ZMQ z Z.SecurityMechanism
    mechanism :: forall z t. Socket z t -> ZMQ z SecurityMechanism
    mechanism = IO SecurityMechanism -> ZMQ z SecurityMechanism
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO SecurityMechanism -> ZMQ z SecurityMechanism)
    -> (Socket z t -> IO SecurityMechanism)
    -> Socket z t
    -> ZMQ z SecurityMechanism
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO SecurityMechanism
    forall a. Socket a -> IO SecurityMechanism
    Z.mechanism (Socket t -> IO SecurityMechanism)
    -> (Socket z t -> Socket t) -> Socket z t -> IO SecurityMechanism
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    moreToReceive :: Socket z t -> ZMQ z Bool
    moreToReceive :: forall z t. Socket z t -> ZMQ z Bool
    moreToReceive = IO Bool -> ZMQ z Bool
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bool -> ZMQ z Bool)
    -> (Socket z t -> IO Bool) -> Socket z t -> ZMQ z Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Bool
    forall a. Socket a -> IO Bool
    Z.moreToReceive (Socket t -> IO Bool)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    plainServer :: Socket z t -> ZMQ z Bool
    plainServer :: forall z t. Socket z t -> ZMQ z Bool
    plainServer = IO Bool -> ZMQ z Bool
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Bool -> ZMQ z Bool)
    -> (Socket z t -> IO Bool) -> Socket z t -> ZMQ z Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Bool
    forall a. Socket a -> IO Bool
    Z.plainServer (Socket t -> IO Bool)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    plainPassword :: Socket z t -> ZMQ z ByteString
    plainPassword :: forall z t. Socket z t -> ZMQ z ByteString
    plainPassword = IO ByteString -> ZMQ z ByteString
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO ByteString -> ZMQ z ByteString)
    -> (Socket z t -> IO ByteString) -> Socket z t -> ZMQ z ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO ByteString
    forall a. Socket a -> IO ByteString
    Z.plainPassword (Socket t -> IO ByteString)
    -> (Socket z t -> Socket t) -> Socket z t -> IO ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    plainUserName :: Socket z t -> ZMQ z ByteString
    plainUserName :: forall z t. Socket z t -> ZMQ z ByteString
    plainUserName = IO ByteString -> ZMQ z ByteString
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO ByteString -> ZMQ z ByteString)
    -> (Socket z t -> IO ByteString) -> Socket z t -> ZMQ z ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO ByteString
    forall a. Socket a -> IO ByteString
    Z.plainUserName (Socket t -> IO ByteString)
    -> (Socket z t -> Socket t) -> Socket z t -> IO ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    rate :: Socket z t -> ZMQ z Int
    rate :: forall z t. Socket z t -> ZMQ z Int
    rate = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.rate (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    receiveBuffer :: Socket z t -> ZMQ z Int
    receiveBuffer :: forall z t. Socket z t -> ZMQ z Int
    receiveBuffer = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.receiveBuffer (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    receiveHighWM :: Socket z t -> ZMQ z Int
    receiveHighWM :: forall z t. Socket z t -> ZMQ z Int
    receiveHighWM = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.receiveHighWM (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    receiveTimeout :: Socket z t -> ZMQ z Int
    receiveTimeout :: forall z t. Socket z t -> ZMQ z Int
    receiveTimeout = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.receiveTimeout (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    reconnectInterval :: Socket z t -> ZMQ z Int
    reconnectInterval :: forall z t. Socket z t -> ZMQ z Int
    reconnectInterval = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.reconnectInterval (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    reconnectIntervalMax :: Socket z t -> ZMQ z Int
    reconnectIntervalMax :: forall z t. Socket z t -> ZMQ z Int
    reconnectIntervalMax = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.reconnectIntervalMax (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    recoveryInterval :: Socket z t -> ZMQ z Int
    recoveryInterval :: forall z t. Socket z t -> ZMQ z Int
    recoveryInterval = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.recoveryInterval (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    sendBuffer :: Socket z t -> ZMQ z Int
    sendBuffer :: forall z t. Socket z t -> ZMQ z Int
    sendBuffer = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.sendBuffer (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    sendHighWM :: Socket z t -> ZMQ z Int
    sendHighWM :: forall z t. Socket z t -> ZMQ z Int
    sendHighWM = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.sendHighWM (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    sendTimeout :: Socket z t -> ZMQ z Int
    sendTimeout :: forall z t. Socket z t -> ZMQ z Int
    sendTimeout = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.sendTimeout (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    tcpKeepAlive :: Socket z t -> ZMQ z Z.Switch
    tcpKeepAlive :: forall z t. Socket z t -> ZMQ z Switch
    tcpKeepAlive = IO Switch -> ZMQ z Switch
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Switch -> ZMQ z Switch)
    -> (Socket z t -> IO Switch) -> Socket z t -> ZMQ z Switch
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Switch
    forall a. Socket a -> IO Switch
    Z.tcpKeepAlive (Socket t -> IO Switch)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Switch
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    tcpKeepAliveCount :: Socket z t -> ZMQ z Int
    tcpKeepAliveCount :: forall z t. Socket z t -> ZMQ z Int
    tcpKeepAliveCount = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.tcpKeepAliveCount (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    tcpKeepAliveIdle :: Socket z t -> ZMQ z Int
    tcpKeepAliveIdle :: forall z t. Socket z t -> ZMQ z Int
    tcpKeepAliveIdle = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.tcpKeepAliveIdle (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    tcpKeepAliveInterval :: Socket z t -> ZMQ z Int
    tcpKeepAliveInterval :: forall z t. Socket z t -> ZMQ z Int
    tcpKeepAliveInterval = IO Int -> ZMQ z Int
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int -> ZMQ z Int)
    -> (Socket z t -> IO Int) -> Socket z t -> ZMQ z Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO Int
    forall a. Socket a -> IO Int
    Z.tcpKeepAliveInterval (Socket t -> IO Int)
    -> (Socket z t -> Socket t) -> Socket z t -> IO Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    zapDomain :: Socket z t -> ZMQ z ByteString
    zapDomain :: forall z t. Socket z t -> ZMQ z ByteString
    zapDomain = IO ByteString -> ZMQ z ByteString
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO ByteString -> ZMQ z ByteString)
    -> (Socket z t -> IO ByteString) -> Socket z t -> ZMQ z ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO ByteString
    forall a. Socket a -> IO ByteString
    Z.zapDomain (Socket t -> IO ByteString)
    -> (Socket z t -> Socket t) -> Socket z t -> IO ByteString
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    -- * Socket Options (Write)

    setAffinity :: Word64 -> Socket z t -> ZMQ z ()
    setAffinity :: forall z t. Word64 -> Socket z t -> ZMQ z ()
    setAffinity Word64
    a = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word64 -> Socket t -> IO ()
    forall a. Word64 -> Socket a -> IO ()
    Z.setAffinity Word64
    a (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setBacklog :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setBacklog :: forall i z t.
    Integral i =>
    Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setBacklog Restricted (N0, Int32) i
    b = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N0, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N0, Int32) i -> Socket a -> IO ()
    Z.setBacklog Restricted (N0, Int32) i
    b (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setConflate :: Z.Conflatable t => Bool -> Socket z t -> ZMQ z ()
    setConflate :: forall t z. Conflatable t => Bool -> Socket z t -> ZMQ z ()
    setConflate Bool
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket t -> IO ()
    forall a. Conflatable a => Bool -> Socket a -> IO ()
    Z.setConflate Bool
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setCurvePublicKey :: Z.KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
    setCurvePublicKey :: forall f z t.
    KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
    setCurvePublicKey KeyFormat f
    f Restricted f ByteString
    k = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . KeyFormat f -> Restricted f ByteString -> Socket t -> IO ()
    forall f a.
    KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
    Z.setCurvePublicKey KeyFormat f
    f Restricted f ByteString
    k (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setCurveSecretKey :: Z.KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
    setCurveSecretKey :: forall f z t.
    KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
    setCurveSecretKey KeyFormat f
    f Restricted f ByteString
    k = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . KeyFormat f -> Restricted f ByteString -> Socket t -> IO ()
    forall f a.
    KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
    Z.setCurveSecretKey KeyFormat f
    f Restricted f ByteString
    k (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setCurveServer :: Bool -> Socket z t -> ZMQ z ()
    setCurveServer :: forall z t. Bool -> Socket z t -> ZMQ z ()
    setCurveServer Bool
    b = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket t -> IO ()
    forall a. Bool -> Socket a -> IO ()
    Z.setCurveServer Bool
    b (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setCurveServerKey :: Z.KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
    setCurveServerKey :: forall f z t.
    KeyFormat f -> Restricted f ByteString -> Socket z t -> ZMQ z ()
    setCurveServerKey KeyFormat f
    f Restricted f ByteString
    k = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . KeyFormat f -> Restricted f ByteString -> Socket t -> IO ()
    forall f a.
    KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
    Z.setCurveServerKey KeyFormat f
    f Restricted f ByteString
    k (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setDelayAttachOnConnect :: Bool -> Socket z t -> ZMQ z ()
    setDelayAttachOnConnect :: forall z t. Bool -> Socket z t -> ZMQ z ()
    setDelayAttachOnConnect Bool
    d = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket t -> IO ()
    forall a. Bool -> Socket a -> IO ()
    Z.setDelayAttachOnConnect Bool
    d (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket
    {-# DEPRECATED setDelayAttachOnConnect "Use setImmediate" #-}

    setIdentity :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
    setIdentity :: forall z t.
    Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
    setIdentity Restricted (N1, N254) ByteString
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N1, N254) ByteString -> Socket t -> IO ()
    forall a. Restricted (N1, N254) ByteString -> Socket a -> IO ()
    Z.setIdentity Restricted (N1, N254) ByteString
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setImmediate :: Bool -> Socket z t -> ZMQ z ()
    setImmediate :: forall z t. Bool -> Socket z t -> ZMQ z ()
    setImmediate Bool
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket t -> IO ()
    forall a. Bool -> Socket a -> IO ()
    Z.setImmediate Bool
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setIpv4Only :: Bool -> Socket z t -> ZMQ z ()
    setIpv4Only :: forall z t. Bool -> Socket z t -> ZMQ z ()
    setIpv4Only Bool
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket t -> IO ()
    forall a. Bool -> Socket a -> IO ()
    Z.setIpv4Only Bool
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket
    {-# DEPRECATED setIpv4Only "Use setIpv6" #-}

    setIpv6 :: Bool -> Socket z t -> ZMQ z ()
    setIpv6 :: forall z t. Bool -> Socket z t -> ZMQ z ()
    setIpv6 Bool
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket t -> IO ()
    forall a. Bool -> Socket a -> IO ()
    Z.setIpv6 Bool
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setLinger :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setLinger :: forall i z t.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setLinger Restricted (Nneg1, Int32) i
    l = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (Nneg1, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket a -> IO ()
    Z.setLinger Restricted (Nneg1, Int32) i
    l (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setMaxMessageSize :: Integral i => Restricted (Nneg1, Int64) i -> Socket z t -> ZMQ z ()
    setMaxMessageSize :: forall i z t.
    Integral i =>
    Restricted (Nneg1, Int64) i -> Socket z t -> ZMQ z ()
    setMaxMessageSize Restricted (Nneg1, Int64) i
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (Nneg1, Int64) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (Nneg1, Int64) i -> Socket a -> IO ()
    Z.setMaxMessageSize Restricted (Nneg1, Int64) i
    s (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setMcastHops :: Integral i => Restricted (N1, Int32) i -> Socket z t -> ZMQ z ()
    setMcastHops :: forall i z t.
    Integral i =>
    Restricted (N1, Int32) i -> Socket z t -> ZMQ z ()
    setMcastHops Restricted (N1, Int32) i
    k = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N1, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N1, Int32) i -> Socket a -> IO ()
    Z.setMcastHops Restricted (N1, Int32) i
    k (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setPlainServer :: Bool -> Socket z t -> ZMQ z ()
    setPlainServer :: forall z t. Bool -> Socket z t -> ZMQ z ()
    setPlainServer Bool
    b = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket t -> IO ()
    forall a. Bool -> Socket a -> IO ()
    Z.setPlainServer Bool
    b (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setPlainPassword :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
    setPlainPassword :: forall z t.
    Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
    setPlainPassword Restricted (N1, N254) ByteString
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N1, N254) ByteString -> Socket t -> IO ()
    forall a. Restricted (N1, N254) ByteString -> Socket a -> IO ()
    Z.setPlainPassword Restricted (N1, N254) ByteString
    s (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setPlainUserName :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
    setPlainUserName :: forall z t.
    Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
    setPlainUserName Restricted (N1, N254) ByteString
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N1, N254) ByteString -> Socket t -> IO ()
    forall a. Restricted (N1, N254) ByteString -> Socket a -> IO ()
    Z.setPlainUserName Restricted (N1, N254) ByteString
    s (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setProbeRouter :: Z.SendProbe t => Bool -> Socket z t -> ZMQ z ()
    setProbeRouter :: forall t z. SendProbe t => Bool -> Socket z t -> ZMQ z ()
    setProbeRouter Bool
    b = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket t -> IO ()
    forall a. SendProbe a => Bool -> Socket a -> IO ()
    Z.setProbeRouter Bool
    b (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setRate :: Integral i => Restricted (N1, Int32) i -> Socket z t -> ZMQ z ()
    setRate :: forall i z t.
    Integral i =>
    Restricted (N1, Int32) i -> Socket z t -> ZMQ z ()
    setRate Restricted (N1, Int32) i
    r = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N1, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N1, Int32) i -> Socket a -> IO ()
    Z.setRate Restricted (N1, Int32) i
    r (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setReceiveBuffer :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setReceiveBuffer :: forall i z t.
    Integral i =>
    Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setReceiveBuffer Restricted (N0, Int32) i
    k = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N0, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N0, Int32) i -> Socket a -> IO ()
    Z.setReceiveBuffer Restricted (N0, Int32) i
    k (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setReceiveHighWM :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setReceiveHighWM :: forall i z t.
    Integral i =>
    Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setReceiveHighWM Restricted (N0, Int32) i
    k = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N0, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N0, Int32) i -> Socket a -> IO ()
    Z.setReceiveHighWM Restricted (N0, Int32) i
    k (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setReceiveTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setReceiveTimeout :: forall i z t.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setReceiveTimeout Restricted (Nneg1, Int32) i
    t = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (Nneg1, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket a -> IO ()
    Z.setReceiveTimeout Restricted (Nneg1, Int32) i
    t (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setReconnectInterval :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setReconnectInterval :: forall i z t.
    Integral i =>
    Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setReconnectInterval Restricted (N0, Int32) i
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N0, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N0, Int32) i -> Socket a -> IO ()
    Z.setReconnectInterval Restricted (N0, Int32) i
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setReconnectIntervalMax :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setReconnectIntervalMax :: forall i z t.
    Integral i =>
    Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setReconnectIntervalMax Restricted (N0, Int32) i
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N0, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N0, Int32) i -> Socket a -> IO ()
    Z.setReconnectIntervalMax Restricted (N0, Int32) i
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setRecoveryInterval :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setRecoveryInterval :: forall i z t.
    Integral i =>
    Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setRecoveryInterval Restricted (N0, Int32) i
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N0, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N0, Int32) i -> Socket a -> IO ()
    Z.setRecoveryInterval Restricted (N0, Int32) i
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setReqCorrelate :: Bool -> Socket z Z.Req -> ZMQ z ()
    setReqCorrelate :: forall z. Bool -> Socket z Req -> ZMQ z ()
    setReqCorrelate Bool
    b = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z Req -> IO ()) -> Socket z Req -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket Req -> IO ()
    Z.setReqCorrelate Bool
    b (Socket Req -> IO ())
    -> (Socket z Req -> Socket Req) -> Socket z Req -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z Req -> Socket Req
    forall z t. Socket z t -> Socket t
    _unsocket

    setReqRelaxed :: Bool -> Socket z Z.Req -> ZMQ z ()
    setReqRelaxed :: forall z. Bool -> Socket z Req -> ZMQ z ()
    setReqRelaxed Bool
    b = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z Req -> IO ()) -> Socket z Req -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket Req -> IO ()
    Z.setReqRelaxed Bool
    b (Socket Req -> IO ())
    -> (Socket z Req -> Socket Req) -> Socket z Req -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z Req -> Socket Req
    forall z t. Socket z t -> Socket t
    _unsocket

    setRouterMandatory :: Bool -> Socket z Z.Router -> ZMQ z ()
    setRouterMandatory :: forall z. Bool -> Socket z Router -> ZMQ z ()
    setRouterMandatory Bool
    b = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z Router -> IO ()) -> Socket z Router -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket Router -> IO ()
    Z.setRouterMandatory Bool
    b (Socket Router -> IO ())
    -> (Socket z Router -> Socket Router) -> Socket z Router -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z Router -> Socket Router
    forall z t. Socket z t -> Socket t
    _unsocket

    setSendBuffer :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setSendBuffer :: forall i z t.
    Integral i =>
    Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setSendBuffer Restricted (N0, Int32) i
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N0, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N0, Int32) i -> Socket a -> IO ()
    Z.setSendBuffer Restricted (N0, Int32) i
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setSendHighWM :: Integral i => Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setSendHighWM :: forall i z t.
    Integral i =>
    Restricted (N0, Int32) i -> Socket z t -> ZMQ z ()
    setSendHighWM Restricted (N0, Int32) i
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N0, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (N0, Int32) i -> Socket a -> IO ()
    Z.setSendHighWM Restricted (N0, Int32) i
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setSendTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setSendTimeout :: forall i z t.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setSendTimeout Restricted (Nneg1, Int32) i
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (Nneg1, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket a -> IO ()
    Z.setSendTimeout Restricted (Nneg1, Int32) i
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setTcpAcceptFilter :: Maybe ByteString -> Socket z t -> ZMQ z ()
    setTcpAcceptFilter :: forall z t. Maybe ByteString -> Socket z t -> ZMQ z ()
    setTcpAcceptFilter Maybe ByteString
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Maybe ByteString -> Socket t -> IO ()
    forall a. Maybe ByteString -> Socket a -> IO ()
    Z.setTcpAcceptFilter Maybe ByteString
    s (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setTcpKeepAlive :: Z.Switch -> Socket z t -> ZMQ z ()
    setTcpKeepAlive :: forall z t. Switch -> Socket z t -> ZMQ z ()
    setTcpKeepAlive Switch
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Switch -> Socket t -> IO ()
    forall a. Switch -> Socket a -> IO ()
    Z.setTcpKeepAlive Switch
    s (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setTcpKeepAliveCount :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setTcpKeepAliveCount :: forall i z t.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setTcpKeepAliveCount Restricted (Nneg1, Int32) i
    c = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (Nneg1, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket a -> IO ()
    Z.setTcpKeepAliveCount Restricted (Nneg1, Int32) i
    c (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setTcpKeepAliveIdle :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setTcpKeepAliveIdle :: forall i z t.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setTcpKeepAliveIdle Restricted (Nneg1, Int32) i
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (Nneg1, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket a -> IO ()
    Z.setTcpKeepAliveIdle Restricted (Nneg1, Int32) i
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setTcpKeepAliveInterval :: Integral i => Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setTcpKeepAliveInterval :: forall i z t.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket z t -> ZMQ z ()
    setTcpKeepAliveInterval Restricted (Nneg1, Int32) i
    i = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (Nneg1, Int32) i -> Socket t -> IO ()
    forall i a.
    Integral i =>
    Restricted (Nneg1, Int32) i -> Socket a -> IO ()
    Z.setTcpKeepAliveInterval Restricted (Nneg1, Int32) i
    i (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    setXPubVerbose :: Bool -> Socket z Z.XPub -> ZMQ z ()
    setXPubVerbose :: forall z. Bool -> Socket z XPub -> ZMQ z ()
    setXPubVerbose Bool
    b = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z XPub -> IO ()) -> Socket z XPub -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Bool -> Socket XPub -> IO ()
    Z.setXPubVerbose Bool
    b (Socket XPub -> IO ())
    -> (Socket z XPub -> Socket XPub) -> Socket z XPub -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z XPub -> Socket XPub
    forall z t. Socket z t -> Socket t
    _unsocket

    setZapDomain :: Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
    setZapDomain :: forall z t.
    Restricted (N1, N254) ByteString -> Socket z t -> ZMQ z ()
    setZapDomain Restricted (N1, N254) ByteString
    s = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Restricted (N1, N254) ByteString -> Socket t -> IO ()
    forall a. Restricted (N1, N254) ByteString -> Socket a -> IO ()
    Z.setZapDomain Restricted (N1, N254) ByteString
    s (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    -- * Low Level Functions

    waitRead :: Socket z t -> ZMQ z ()
    waitRead :: forall z t. Socket z t -> ZMQ z ()
    waitRead = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO ()
    forall a. Socket a -> IO ()
    Z.waitRead (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    waitWrite :: Socket z t -> ZMQ z ()
    waitWrite :: forall z t. Socket z t -> ZMQ z ()
    waitWrite = IO () -> ZMQ z ()
    forall a. IO a -> ZMQ z a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> ZMQ z ())
    -> (Socket z t -> IO ()) -> Socket z t -> ZMQ z ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket t -> IO ()
    forall a. Socket a -> IO ()
    Z.waitWrite (Socket t -> IO ())
    -> (Socket z t -> Socket t) -> Socket z t -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Socket z t -> Socket t
    forall z t. Socket z t -> Socket t
    _unsocket

    -- * Internal

    onContext :: (Z.Context -> IO a) -> ZMQ z a
    onContext :: forall a z. (Context -> IO a) -> ZMQ z a
    onContext Context -> IO a
    f = ReaderT ZMQEnv IO a -> ZMQ z a
    forall z a. ReaderT ZMQEnv IO a -> ZMQ z a
    ZMQ (ReaderT ZMQEnv IO a -> ZMQ z a) -> ReaderT ZMQEnv IO a -> ZMQ z a
    forall a b. (a -> b) -> a -> b
    $! (ZMQEnv -> Context) -> ReaderT ZMQEnv IO Context
    forall (m :: * -> *) r a. Monad m => (r -> a) -> ReaderT r m a
    asks ZMQEnv -> Context
    _context ReaderT ZMQEnv IO Context
    -> (Context -> ReaderT ZMQEnv IO a) -> ReaderT ZMQEnv IO a
    forall a b.
    ReaderT ZMQEnv IO a
    -> (a -> ReaderT ZMQEnv IO b) -> ReaderT ZMQEnv IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= IO a -> ReaderT ZMQEnv IO a
    forall a. IO a -> ReaderT ZMQEnv IO a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO a -> ReaderT ZMQEnv IO a)
    -> (Context -> IO a) -> Context -> ReaderT ZMQEnv IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Context -> IO a
    f

    term :: ZMQEnv -> IO ()
    term :: ZMQEnv -> IO ()
    term ZMQEnv
    env = do
        n <- IORef Word -> (Word -> (Word, Word)) -> IO Word
    forall a b. IORef a -> (a -> (a, b)) -> IO b
    atomicModifyIORef (ZMQEnv -> IORef Word
    _refcount ZMQEnv
    env) ((Word -> (Word, Word)) -> IO Word)
    -> (Word -> (Word, Word)) -> IO Word
    forall a b. (a -> b) -> a -> b
    $ \Word
    n -> (Word -> Word
    forall a. Enum a => a -> a
    pred Word
    n, Word
    n)
        when (n == 1) $ do
            readIORef (_sockets env) >>= mapM_ close'
            Z.term (_context env)
      where
        close' :: SocketRepr -> IO ()
    close' SocketRepr
    s = SocketRepr -> IO ()
    I.closeSock SocketRepr
    s IO () -> (SomeException -> IO ()) -> IO ()
    forall e a. Exception e => IO a -> (e -> IO a) -> IO a
    `E.catch` (\SomeException
    e -> SomeException -> IO ()
    forall a. Show a => a -> IO ()
    print (SomeException
    e :: E.SomeException))