[Haskell-cafe] Serializing with alignment

Ben Franksen ben.franksen at online.de
Wed Nov 7 01:58:20 CET 2012

Vincent Hanquez wrote:
> On 11/06/2012 09:33 PM, Ben Franksen wrote:
>> I want to implement a binary protocol that, unfortunately, has some
>> alignment restrictions.
>> [snip]
> I don't think such thing currently exists.

Feared so.

> Not sure that's any help to you (and definitely not answering your 
> binary question), but I rolled my own 'put' for a dbus implementation:
> https://github.com/vincenthz/hs-udbus/blob/master/Network/DBus/Wire.hs

Interesting. Seems you also needed aligned read/write. You are using a state 
monad, too. Maybe I should just go ahead and wrap a StateT over the PutM 
from binary, at least this lets me re-use the efficient concatenation that's 
built into binary's PutM (or rather, the Builder below it).

Ben Franksen
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments

More information about the Haskell-Cafe mailing list