[Haskell-cafe] two problems with Data.Binary and Data.ByteString
Bryan O'Sullivan
bos at serpentine.com
Wed Aug 13 23:17:00 EDT 2008
On Wed, Aug 13, 2008 at 3:02 PM, Tim Newsham <newsham at lava.net> wrote:
> However, I think probably the real blame here should probably go
> to Data.Binary which doesn't attempt to check that it has consumed
> all of its input after doing a "decode". If "decode" completes
> and there is unconsumed data, it should probably raise an error
> (it already raises errors for premature EOF). There's no reason
> for it not to, since it does not provide the unconsumed data to
> the caller when its done, anyway...
You missed runGetState in Data.Binary.Get, which I added. It's
definitely not an error in the abstract to have excess input after
you're done decoding. In your specific application, it might be, but
then you should write a combinator that checks for this state.
More information about the Haskell-Cafe
mailing list