Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-10 Thread Twan van Laarhoven
On 2012-04-07 23:35, Myles C. Maxfield wrote: CC: Maintainers of STMonadTrans, Vector, and JuicyPixels Hello, I am writing a Haskell Attoparsec parser which will modify 2-d arrays of small values (Word8, Int8, etc.). My first idea was to simply parse all the deltas, and later apply them to the

Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-10 Thread Mario Blažević
On 12-04-07 05:35 PM, Myles C. Maxfield wrote: So here are my questions: ... 3. Are there any parsers that support streaming semantics and being used as a monad transformer? This would require rewriting my whole program to use this new parser, but if that's what I have to do, then so be it. H

Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-08 Thread Stephen Tetley
On 8 April 2012 19:17, Myles C. Maxfield wrote: > It's a JPEG parser. Ahem, I'm a bit of of my depth then, but one thing you should consider is that writing your own parser monad is trivial, especially for well defined binary formats. Well defined binary formats should be deterministic and d

Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-08 Thread Myles C. Maxfield
It's a JPEG parser. Progressive JPEG is set up where there's a vector Word8s, and some of the entries in the vector may be 0. The JPEG has a stream of bits, and the decoder is supposed to shift in one bit to each successive element in the vector, skipping over 0s, and stop when it reaches some spe

Re: [Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-07 Thread Stephen Tetley
Hi Myles It seems odd to mix parsing (consuming input) with mutation. What problem are you trying to solve and are you sure you can't get better phase separation than this paragraph suggests? > My first idea was to simply parse all the deltas, and later apply them > to the input list. However,

[Haskell-cafe] Mixing Unboxed Mutable Vectors and Parsers

2012-04-07 Thread Myles C. Maxfield
CC: Maintainers of STMonadTrans, Vector, and JuicyPixels Hello, I am writing a Haskell Attoparsec parser which will modify 2-d arrays of small values (Word8, Int8, etc.). My first idea was to simply parse all the deltas, and later apply them to the input list. However, I can't do that because the