
28 Apr
2003
28 Apr
'03
10:32 a.m.
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 PackedString containing the remainder of the file. However, if h is already at the end of the file, an exception is raised rather than returning an 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. Cheers, Simon