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

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Aug 14 14:17:16 EDT 2008

On Thu, 2008-08-14 at 10:21 -0700, Don Stewart wrote:

> > I think you're right. The Binary instances cannot and must not read more
> > than they need to, so that gives us the behaviour that we read exactly
> > the length of the file, but no more, and thus we never hit EOF, so we
> > don't close the file. So yes, decode should force the tail so that it
> > can indeed hit EOF.
> Duncan, 
> You're suggesting that decode and decodeFile should whnf the next cell?

At least decodeFile should, since it doesn't give you any other access
to the file handle otherwise.

Does decode return the tail? I don't remember. If not it should also
whnf it. If it does then the user can choose (they might want to do
something else with the trailing data).


More information about the Haskell-Cafe mailing list