H98 errata

Ross Paterson ross@soi.city.ac.uk
Wed, 19 Feb 2003 19:01:29 +0000


The definition of getLine given in 8.3:

getLine    :: IO String
getLine    =  do c <- getChar
                 if c == '\n' then return "" else
                    do s <- getLine
                       return (c:s)

is incorrect in view of

7.1: The getLine operation raises an exception under the same 
circumstances as hGetLine, defined [in] the IO library.
("in" is missing from the published Report.)

21.9.2: The hGetLine computation fails with isEOFError if the 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.