bug in hGetPS?

Simon Marlow simonmar@microsoft.com
Mon, 28 Apr 2003 11:32:53 +0100

> I'm not sure if this counts as a bug or a feature...
> If hGetPS h len encounters an EOF before len, it returns a=20
> PackedString
> containing the remainder of the file.  However, if h is=20
> already at the end
> of the file, an exception is raised rather than returning an=20
> empty string.
> To me this is rather counter-intuitive.

It matches the behaviour of System.IO.hGetLine.

Data.PackedString.hGetPS behaves in the way you're suggesting: it just
returns short reads instead of flagging EOF.  Unfortuantely this is
inconsistent with hGetLine, so I'm not sure if the behaviour should stay
that way.