[Haskell-cafe] two problems with Data.Binary and Data.ByteString

Bryan O'Sullivan bos at serpentine.com
Wed Aug 13 23:19:51 EDT 2008

On Wed, Aug 13, 2008 at 5:39 PM, Tim Newsham <newsham at lava.net> wrote:
> So am I understanding you correctly that you believe this is not
> a bug?  That the use Data.Binary.decodeFile function leaks a file
> descriptor and this is proper behavior?

I think he might be saying that decodeFile is not the place for
checking this condition. I will put words in his mouth and say that
checking for EOF after a decode is the responsibility of the
application code, because the lower level cannot possibly know whether
it makes sense for there to be residual data in the ByteString. There
are plenty of file formats that consist of back-to-back concatenated
chunks of data, in which reading just one chunk does not by any means
require that a file can only contain one.

More information about the Haskell-Cafe mailing list