Re: [Haskell-cafe] Parsing binary data question

2011-09-28 Thread Eric Rasmussen
Hi Michael, I recommend Attoparsec when parsing raw data into custom data types. There aren't as many examples and tutorials as there are for Parsec, but the API is very similar, and some of the important differences are listed on Attoparsec's Hackage entry. There are also helpful examples of its

[Haskell-cafe] Parsing binary data question

2011-09-27 Thread Michael Oswald
Hello all, I am currently working on parser for some packets received via the network. The data structure currently is like that: data Value = ValUInt8 Int8 | ValUInt16 Int16 | ValUInt32 Int32 -- more datatypes data Parameter = Parameter { paramName ::

Re: [Haskell-cafe] Parsing binary data.

2007-08-22 Thread Lutz Donnerhacke
* Tony Finch wrote: http://erlang.org/doc/programming_examples/bit_syntax.html#4 The IP header example in the latter is a brilliant real-world example. Unfortunly this example does not handle bit and byte order. Take a look at Ada's representation clauses for such topics.

Re: [Haskell-cafe] Parsing binary data.

2007-08-22 Thread Tony Finch
On Wed, 22 Aug 2007, Lutz Donnerhacke wrote: * Tony Finch wrote: http://erlang.org/doc/programming_examples/bit_syntax.html#4 The IP header example in the latter is a brilliant real-world example. Unfortunly this example does not handle bit and byte order. Take a look at Ada's

Re: [Haskell-cafe] Parsing binary data.

2007-08-21 Thread Tony Finch
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

Re: [Haskell-cafe] Parsing binary data.

2007-08-21 Thread Donald Bruce Stewart
dot: 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

Re: [Haskell-cafe] Parsing binary data.

2007-08-20 Thread Adam Langley
On 8/19/07, Matthew Sackman [EMAIL PROTECTED] wrote: But it's vastly harder to do that for floats / non-integers. Now I know that the number classes in the Prelude are basically broken anyway and all really need rewriting, but it does seem completely arbitrary that Words somehow are only

Re: [Haskell-cafe] Parsing binary data.

2007-08-19 Thread Adam Langley
On 8/18/07, Matthew Sackman [EMAIL PROTECTED] wrote: Also, one thing to watch out for is the fact the existing Get and Put instances may not do anything like what you expect. For example, for some reason I expected that the instances of Get and Put for Float and Double would send across the

[Haskell-cafe] Parsing binary data.

2007-08-18 Thread Peter Cai
Hi all, Recently I am considering doing part of my job using Haskell. My duty is writing a network server which talks to another server through a binary based private protocol. As the old version of this component is written in C, it's very natural that this protocol is base on C structure

Re: [Haskell-cafe] Parsing binary data.

2007-08-18 Thread Marc Weber
As I am a newbie to Haskell, I am not sure how to handle this problem with less work. Do you have any ideas about this problem? Thanks in advance! Have a look at http://haskell.org/haskellwiki/Applications_and_libraries/Data_structures section 3 (IO) -