[Haskell-cafe] Re: Haskell poker server

2005-08-31 Thread Kimberley Burchett

Hi Joel,

I've been working on a library to parse binary data files (java bytecode 
in my case), and I ended up writing my own DataReader monad for the 
purpose of reading binary streams.  It offers two main features:


 * It keeps track of how many bytes you've read.  This is necessary for 
reading java bytecode, but probably unnecessary for the protocol you're 
using.


 * It supports hierarchical error messages (so you see error while 
reading foo: unexpected end of input instead of just unexpected end of 
input).


If you're interested, you can check it out here:

  http://www.kimbly.com/code/JavaBytecode/

Kim

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Haskell poker server

2005-08-30 Thread Andre Pang

On 31/08/2005, at 7:37 AM, Miles Sabin wrote:

I've been using parsec for binary parsing (Java class files in my  
case)

as a first exercise with both Haskell and combinator parsing, with a
view to applying same to network protocols.


I've also been experimenting with using Parsec to parse binary  
files.  The biggest problem with is that it's a slow, because you're  
working with types of [Char] rather than e.g. UArray Word8.  This is  
usually fine if you're doing on-the-fly processing or are working  
with small files, but in my case, I was working with 1GB+ video  
files.  Having over 1,000,000 list cells of one character each gets a  
tad slow :).


I did a little bit of work (with emphasis on 'little') to start  
refactoring Parsec so it can work with generic sequences instead of  
just lists (so you can make it work with arrays), but haven't gotten  
too far.  Having Parsec work speedily with binary files would  
absolutely rock -- I suspect there are a lot of people who've never  
thought about using parser combinators to process binary data, and if  
it's a feasible option ...



--
% Andre Pang : trust.in.love.to.save  http://www.algorithm.com.au/


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe