On Wed, 2008-08-13 at 12:02 -1000, Tim Newsham 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... > > Thoughts?
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 _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
