zeromq-haskell: bindings to zeromq

[ ffi, library, mit, system ] [ Propose Tags ]

The 0MQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products. 0MQ sockets provide an abstraction of asynchronous message queues, multiple messaging patterns, message filtering (subscriptions), seamless access to multiple transport protocols and more. This library provides the Haskell language binding to 0MQ and supports 0MQ 2.x as well as 3.x (use -fzmq2 or -fzmq3 to select between the two).

[Skip to Readme]
Versions [faq] 0.1, 0.1.1, 0.1.2, 0.2, 0.2.1, 0.2.2, 0.3, 0.3.1, 0.4, 0.4.1, 0.4.2, 0.5.0, 0.6.0, 0.7.0, 0.7.1, 0.8, 0.8.1, 0.8.2, 0.8.3, 0.8.4
Dependencies base (>=3 && <5), bytestring, containers [details]
License MIT
Copyright Copyright (c) 2011 zeromq-haskell authors
Author Toralf Wittner
Category System, FFI
Home page
Source repo head: git clone
Uploaded by ToralfWittner at 2011-12-03T21:32:48Z
Distributions NixOS:0.8.4
Downloads 13862 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]





Compile with 0MQ 2.x


Compile with 0MQ 3.x


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees

Readme for zeromq-haskell-0.8.1

[back to package description]

This library provides Haskell bindings to zeromq (

Current status

This software currently has beta status, i.e. it had seen limited testing.

Version 0.8.1 - zmqVersion has been renamed to version and reports the runtime version of 0MQ, instead of the compile time version macros.

Version 0.8.0 - zeromq-haskell can now be compiled either against 0MQ 2.x (default) or 0MQ 3.x.

Version 0.7.1 - Removes unix dependency

Verison 0.7.0 - Changes semantics of poll to return a list of the same length as it's parameter to allow identification of Sockets by index. PollEvent gets another constructor None to denote the absence of polling events.

Version 0.6.0 - This version renames "with" to "withContext" and introduces a new "withSocket" resource wrapper. The API is otherwise identical to 0.5.0

This software requires zeromq version 2.1.x.


As usual for Haskell packages this software is installed best via Cabal ( In addition to GHC it depends on 0MQ of course. Please note that by default zeromq-haskell attempts to compile against 0MQ 2.x. If instead you want to use 0MQ 3.x, then provide the following flags to Cabal:

--flags="-zmq2 zmq3"


zeromq-haskell mostly follows 0MQ's API. One difference though is that sockets are parameterized types, i.e. there is not one socket type but when creating a socket the desired socket type has to be specified, e.g. Pair and the resulting socket is of type Socket Pair. This additional type information is used to ensure that only options applicable to the socket type can be set, hence ZMQ_SUBSCRIBE and ZMQ_UNSUBSCRIBE which only apply to ZMQ_SUB sockets have their own functions (subscribe and unsubscribe) which can only be used with sockets of type Socket Sub.

Other differences are mostly for convenience. Also one does not deal directly with 0MQ messages, instead these are created internally as needed.


The test folder contains some simple tests mostly mimicking the ones that come with 0MQ.


If you find any bugs or other shortcomings I would greatly appreciate a bug report, preferably via or e-mail to