How about the following:
* change the Report (7.1) to say something
along the lines of:
getChar raises an exception (Section 7.3) on end-of-file;
a
predicate isEOFError that identifies this exception is
defined
in the IO library. getLine raises an end-of-file
exception
under the same conditions as hGetLine in the IO
library.
* in the Library Report, say when hGetLine raises an exception:
Computation hGetLine hdl reads a line from the file
or
channel managed by hdl. The Prelude's getLine is a shorthand
for hGetLine
stdin.
Error reporting: the hWaitForInput, hReady
and hGetChar
computations
may fail with: isEOFError if the
end of file has
been reached.
hGetLine will also fail with isEOFError if end-of-file is
encountered
when reading the first
character of the line. If hGetLine
encounters
end-of-file at any other point while
reading in a line, it is treated as
a line terminator and the (partial)
line is returned.
Actually, I'd prefer if 11.7.1 only dealt with
hWaitForInput and hReady
(as they're the "checking for input" operations).
A second section,
named "Reading input", would then be concerned
with hGetChar and
hGetLine.
--sigbjorn
----- Original Message -----
Sent: Tuesday, June 04, 2002 04:03
Subject: RE: cvs commit: hugs98/lib IO.hs
Prelude.hs
> Should I change the Report wording to be clearer?
>
>
Simon
>
> | -----Original Message-----
> | From: Sigbjorn
Finne [mailto:sof@glass.cse.ogi.edu]
> | Sent: 03 June 2002
15:49
> | To: cvs-hugs@haskell.org
> | Subject: cvs commit: hugs98/lib IO.hs Prelude.hs
> |
> |
> | sof
2002/06/03 07:49:12 PDT
> |
> | Modified
files:
> |
lib
IO.hs Prelude.hs
> | Log:
> | Interpret
Report wording for Prelude.getLine and IO.hGetLine
> | to
mean the Right Thing. If EOF is encountered for a partial
>
| line (>= 1 chars), interpret this as '\n'.
>
|
> | Revision Changes
Path
> | 1.4 +25
-8 hugs98/lib/IO.hs
> |
1.25 +23 -5
hugs98/lib/Prelude.hs
> |
_______________________________________________
> | Cvs-hugs mailing
list
> | Cvs-hugs@haskell.org http://www.haskell.org/mailman/listinfo/cvs-hugs
> |