[Haskell-cafe] Parsing binary data.

Donald Bruce Stewart dons at cse.unsw.edu.au
Tue Aug 21 20:49:28 EDT 2007

> On Sun, 19 Aug 2007, Peter Cai wrote:
> >
> > My duty is writing a network server which talks to another server through a
> > binary based private protocol.
> Haskell needs something like Erlang's bit syntax.
> http://erlang.org/doc/reference_manual/expressions.html#6.16
> http://erlang.org/doc/programming_examples/bit_syntax.html#4
> The IP header example in the latter is a brilliant real-world example.
> It has recently been upgraded to support arbitrary bit streams.
> See http://www.it.uu.se/research/group/hipe/papers/padl07.pdf

Yes, we've looked at this in the context of Data.Binary. Rather than
extending the core syntax, on option is to use Template Haskell,


Another is to just use monad and pattern guards, which give quite
reasonable syntax.

-- Don

More information about the Haskell-Cafe mailing list