[Haskell-cafe] ANNOUNCE: dbus-core 0.6 and dbus-client 0.2

John Millikin jmillikin at gmail.com
Tue Dec 8 21:54:32 EST 2009


0.7 released -- exposes the DBus.Wire module, which contains functions
for marshaling and unmarshaling messages. Also supports detecting
invalid UTF-8 when parsing (previously, it'd just error out). No other
significant changes.

https://dl.dropbox.com/u/1947532/dbus-core_0.7/index.html
https://dl.dropbox.com/u/1947532/dbus-core_0.7.pdf

It's difficult to know in advance how many bytes will be needed from
the socket, so unmarshalMessage is written to pull them from a monad.
If you're using it within pure code, you'll want to use
Data.Binary.Get (or similar) to implement your parser:

-------------------------------------------------------------------------------------
import qualified Data.Binary.Get as G
import qualified Data.ByteString.Lazy as BL

bytes = BL.pack [1, 2, 3, 4, 5...]
getBytes = G.getLazyByteString . fromIntegral
received = G.runGet (unmarshalMessage getBytes) bytes
-------------------------------------------------------------------------------------


More information about the Haskell-Cafe mailing list