On 8/18/07, Peter Cai <[EMAIL PROTECTED]> wrote:
> As the old version of this component is written in C, it's very natural that
> this protocol is base on C structure definitions, which are, unfortunately,
> very complicated.  And the worse is that every field in every structure must
> be converted to Network Endian.

You could certainly try Data.Binary[1] for this. It has a nice Get
monad with methods such as getWord32be which sounds like it might be
what you want. One caveat is that it's fully lazy - you get the result
immediately and parse errors can only be caught as exceptions when you
actually come to using the result. This is perfect for very large
messages, but might be slightly wrong for you.

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3

-- 
Adam Langley                                      [EMAIL PROTECTED]
http://www.imperialviolet.org                       650-283-9641
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to