Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Conrad Parker
On 28 July 2010 23:32, Gregory Collins g...@gregorycollins.net wrote: Conrad Parker con...@metadecks.org writes: Hi, I am reading data from a file as strict bytestrings and processing them in an iteratee. As the parsing code uses Data.Binary, the strict bytestrings are then converted to

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Duncan Coutts
On 29 July 2010 07:53, Conrad Parker con...@metadecks.org wrote: Something smells fishy here. I have a hard time believing that binary is reading more input than is available? Could you post more code please? The issue seems to just be the return value for bytes consumed from

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Conrad Parker
On 29 July 2010 17:46, Duncan Coutts duncan.cou...@googlemail.com wrote: On 29 July 2010 07:53, Conrad Parker con...@metadecks.org wrote: Something smells fishy here. I have a hard time believing that binary is reading more input than is available? Could you post more code please? The issue

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Duncan Coutts
On Thu, 2010-07-29 at 19:01 +0900, Conrad Parker wrote: On 29 July 2010 17:46, Duncan Coutts duncan.cou...@googlemail.com wrote: On 29 July 2010 07:53, Conrad Parker con...@metadecks.org wrote: Something smells fishy here. I have a hard time believing that binary is reading more input

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Duncan Coutts
On Thu, 2010-07-29 at 19:17 +0900, Conrad Parker wrote: On 29 July 2010 19:13, Duncan Coutts duncan.cou...@googlemail.com wrote: On Thu, 2010-07-29 at 19:01 +0900, Conrad Parker wrote: On 29 July 2010 17:46, Duncan Coutts duncan.cou...@googlemail.com wrote: On 29 July 2010 07:53, Conrad

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Bryan O'Sullivan
On Wed, Jul 28, 2010 at 8:38 PM, Max Cantor mxcan...@gmail.com wrote: I have a similar issue, I think. The problem with attoparsec is it only covers the unmarshalling side, writing data to disk still requires manually marshalling values into ByteStrings. Data.Binary with Data.Derive provide

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Jason Dagit
On Thu, Jul 29, 2010 at 6:15 AM, Duncan Coutts duncan.cou...@googlemail.com wrote: No idea what WrappedByteString is. WrappedByteString is a newtype wrapper around ByteString that has a phantom type. This allows instances of to be written such that ByteString can be used with the iteratee

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Jason Dagit
On Thu, Jul 29, 2010 at 10:35 AM, Jason Dagit da...@codersbase.com wrote: On Thu, Jul 29, 2010 at 6:15 AM, Duncan Coutts duncan.cou...@googlemail.com wrote: No idea what WrappedByteString is. WrappedByteString is a newtype wrapper around ByteString that has a phantom type. This

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-29 Thread Bryan O'Sullivan
On Thu, Jul 29, 2010 at 10:55 AM, Jason Dagit da...@codersbase.com wrote: Given those constructors for Result, how will you decode a sequence lazily? I deliberately left incremental results out of the attoparsec API, because it's a burrito-filled spacesuit of worms. The problem is that

[Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-28 Thread Conrad Parker
Hi, I am reading data from a file as strict bytestrings and processing them in an iteratee. As the parsing code uses Data.Binary, the strict bytestrings are then converted to lazy bytestrings (using fromWrap which Gregory Collins posted here in January: -- | wrapped bytestring - lazy bytestring

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-28 Thread Gregory Collins
Conrad Parker con...@metadecks.org writes: Hi, I am reading data from a file as strict bytestrings and processing them in an iteratee. As the parsing code uses Data.Binary, the strict bytestrings are then converted to lazy bytestrings (using fromWrap which Gregory Collins posted here in

Re: [Haskell-cafe] data.binary get reading beyond end of input bytestring?

2010-07-28 Thread Max Cantor
I have a similar issue, I think. The problem with attoparsec is it only covers the unmarshalling side, writing data to disk still requires manually marshalling values into ByteStrings. Data.Binary with Data.Derive provide a clean, proven (encode . decode == id) way of doing this. If