Re: [Haskell-cafe] Binary parser combinators and pretty printing

2005-09-15 Thread Einar Karttunen
On 15.09 21:53, Bulat Ziganshin wrote: > EK> data Packet = Packet Word32 Word32 Word32 [FastString] > > well. you can see my own BinaryStream package at http://freearc.narod.ru > > class BinaryData a where > read :: ... > write :: ... I don't think this is a very good solution. Keeping the o

Re: [Haskell-cafe] Binary parser combinators and pretty printing

2005-09-15 Thread Bulat Ziganshin
Hello Einar, Tuesday, September 13, 2005, 7:03:00 PM, you wrote: EK> data Packet = Packet Word32 Word32 Word32 [FastString] well. you can see my own BinaryStream package at http://freearc.narod.ru class BinaryData a where read :: ... write :: ... instance BinaryData Word32 where read = .

Re: [Haskell-cafe] Binary parser combinators and pretty printing

2005-09-14 Thread Einar Karttunen
On 13.09 23:31, Tomasz Zielonka wrote: > How about all these points together?: > > a) Simple monadic interface I think I already have this - minus packaging and documentation. > b) Using better combinators This is lacking. > c) Using TH to generate code for the simple cases I have TH for gene

Re: [Haskell-cafe] Binary parser combinators and pretty printing

2005-09-13 Thread Tomasz Zielonka
On Tue, Sep 13, 2005 at 06:03:00PM +0300, Einar Karttunen wrote: > We will use the following Haskell datatype: > > data Packet = Packet Word32 Word32 Word32 [FastString] > > 1) Simple monadic interface > > [...] > > This works but writing the code gets tedious and dull. > > 2) Using better combi

Re: [Haskell-cafe] Binary parser combinators and pretty printing

2005-09-13 Thread Malcolm Wallace
Einar Karttunen writes: > I am trying to figure out the best interface to binary parser > and pretty printing combinators for network protocols. > > 2) Using better combinators > > packet = w32be <> w32be <> w32be <> lengthPrefixList w32be (lengthPrefixList > w32be bytes) > Has anyone used co

[Haskell-cafe] Binary parser combinators and pretty printing

2005-09-13 Thread Einar Karttunen
Hello I am trying to figure out the best interface to binary parser and pretty printing combinators for network protocols. I am trying to find the most natural syntax to express these parsers in Haskell and would like opinions and new ideas. As an example I will use a protocol with the followin