FW: cvs commit: hugs98/lib IO.hs Prelude.hs

Simon Peyton-Jones simonpj@microsoft.com
Wed, 5 Jun 2002 09:55:27 -0700


This is a multi-part message in MIME format.

--------------InterScan_NT_MIME_Boundary
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C20CB1.CACC1FB8"

------_=_NextPart_001_01C20CB1.CACC1FB8
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Folks
=20
I plan to push out a new draft H98 report this week.  Here is one
suggested
clarification from Sigbjorn, arising from recent uncertainty about the
true
meaning of getLine.
=20
I'll incorporate it unless anyone yells.
=20
Simon
=20
-----Original Message-----
From: Simon Marlow=20
Sent: 05 June 2002 10:27
To: Sigbjorn Finne; Simon Peyton-Jones
Subject: RE: cvs commit: hugs98/lib IO.hs Prelude.hs


Agree with everything Sigbjorn says below.  Also: change the definition
of getLine (section A.3) to be
=20
   getLine =3D hGetLine stdin
=20
Cheers,
    Simon

-----Original Message-----
From: Sigbjorn Finne [mailto:sof@galois.com]=20
Sent: 04 June 2002 16:17
To: Simon Peyton-Jones
Cc: Simon Marlow
Subject: Re: cvs commit: hugs98/lib IO.hs Prelude.hs


How about the following:
=20
* change the Report (7.1) to say something along the lines of:
=20
   getChar raises an exception (Section
<http://research.microsoft.com/Users/simonpj/haskell98-revised/haskell98
-report-html/io-13.html#io-exceptions> 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.
=20
* in the Library Report, say when hGetLine raises an exception:
=20
  Computation hGetLine hdl reads a line from the file or
  channel managed by hdl. The Prelude's getLine is a shorthand
  for hGetLine stdin.
=20
   Error reporting: the hWaitForInput, hReady and hGetChar
  computations may fail with: isEOFError if the end of file has
   been reached.
=20
   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.
=20
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.
=20
=20
--sigbjorn
=20
=20
----- Original Message -----=20
From: "Simon Peyton-Jones" < <mailto:simonpj@microsoft.com>
simonpj@microsoft.com>
To: "Sigbjorn Finne" < <mailto:sof@glass.cse.ogi.edu>
sof@glass.cse.ogi.edu>; < <mailto:simonmar@microsoft.com>
simonmar@microsoft.com>
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?
>=20
> Simon
>=20
> | -----Original Message-----
> | From: Sigbjorn Finne [mailto:sof@glass.cse.ogi.edu]=20
> | Sent: 03 June 2002 15:49
> | To:  <mailto:cvs-hugs@haskell.org> cvs-hugs@haskell.org
> | Subject: cvs commit: hugs98/lib IO.hs Prelude.hs
> |=20
> |=20
> | sof         2002/06/03 07:49:12 PDT
> |=20
> |   Modified files:
> |     lib                  IO.hs Prelude.hs=20
> |   Log:
> |   Interpret Report wording for Prelude.getLine and IO.hGetLine
> |   to mean the Right Thing. If EOF is encountered for a partial
> |   line (>=3D 1 chars), interpret this as '\n'.
> |  =20
> |   Revision  Changes    Path
> |   1.4       +25 -8     hugs98/lib/IO.hs
> |   1.25      +23 -5     hugs98/lib/Prelude.hs
> | _______________________________________________
> | Cvs-hugs mailing list
> |  <mailto:Cvs-hugs@haskell.org> Cvs-hugs@haskell.org
<http://www.haskell.org/mailman/listinfo/cvs-hugs>
http://www.haskell.org/mailman/listinfo/cvs-hugs
> |=20


------_=_NextPart_001_01C20CB1.CACC1FB8
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =

size=3D2>Folks</FONT></SPAN></DIV>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =
size=3D2>I plan=20
to push out a new draft H98 report this week.&nbsp; Here is one=20
suggested</FONT></SPAN></DIV>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =

size=3D2>clarification from Sigbjorn, arising from recent uncertainty =
about the=20
true</FONT></SPAN></DIV>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =

size=3D2>meaning of getLine.</FONT></SPAN></DIV>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =
size=3D2>I'll=20
incorporate it unless anyone yells.</FONT></SPAN></DIV>
<DIV><SPAN class=3D065034716-05062002></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =

size=3D2>Simon</FONT></SPAN></DIV>
<DIV><SPAN class=3D065034716-05062002><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV></DIV>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> Simon Marlow =
<BR><B>Sent:</B>=20
05 June 2002 10:27<BR><B>To:</B> Sigbjorn Finne; Simon=20
Peyton-Jones<BR><B>Subject:</B> RE: cvs commit: hugs98/lib IO.hs=20
Prelude.hs<BR><BR></FONT></DIV>
<DIV><SPAN class=3D020152409-05062002><FONT face=3D"Comic Sans MS" =
color=3D#800080=20
size=3D2>Agree with everything Sigbjorn says below.&nbsp; Also: change =
the=20
definition of getLine (section A.3) to be</FONT></SPAN></DIV>
<DIV><SPAN class=3D020152409-05062002><FONT face=3D"Comic Sans MS" =
color=3D#800080=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D020152409-05062002>&nbsp;<FONT face=3D"Courier =
New">&nbsp; <FONT=20
size=3D2>getLine =3D hGetLine stdin</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=3D020152409-05062002><FONT face=3D"Courier New"=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D020152409-05062002><FONT face=3D"Comic Sans MS" =
color=3D#800080=20
size=3D2>Cheers,</FONT></SPAN></DIV>
<DIV><SPAN class=3D020152409-05062002><FONT face=3D"Comic Sans MS"><FONT =

color=3D#800080>&nbsp;&nbsp;&nbsp; <FONT=20
size=3D2>Simon</FONT></FONT></FONT></SPAN></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #800080 2px =
solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr =
align=3Dleft><FONT=20
  face=3DTahoma size=3D2>-----Original Message-----<BR><B>From:</B> =
Sigbjorn Finne=20
  [mailto:sof@galois.com] <BR><B>Sent:</B> 04 June 2002 =
16:17<BR><B>To:</B>=20
  Simon Peyton-Jones<BR><B>Cc:</B> Simon Marlow<BR><B>Subject:</B> Re: =
cvs=20
  commit: hugs98/lib IO.hs Prelude.hs<BR><BR></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>How about the following:</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>* change the Report (7.1)&nbsp;to say =
something=20
  along the lines of:</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; <FONT=20
  face=3D"Courier New">getChar</FONT> raises an exception (Section =
</FONT><A=20
  =
href=3D"http://research.microsoft.com/Users/simonpj/haskell98-revised/has=
kell98-report-html/io-13.html#io-exceptions"><FONT=20
  face=3DArial size=3D2>7.3</FONT></A><FONT face=3DArial size=3D2>) on =
end-of-file;=20
  a</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; predicate <FONT=20
  face=3D"Courier New">isEOFError</FONT> that identifies this exception =
is=20
  defined</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; in the IO library. <FONT =

  face=3D"Courier New">getLine </FONT><FONT face=3DArial>raises an =
end-of-file=20
  exception</FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; under the same =
conditions as <FONT=20
  face=3D"Courier New">hGetLine </FONT><FONT face=3DArial>in the IO=20
  library.</FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>* in the Library Report, say when =
<FONT=20
  face=3D"Courier New">hGetLine</FONT> raises an exception:</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;<FONT size=3D3><FONT=20
  face=3D"Times New Roman">Computation </FONT><TT>hGetLine</TT><FONT=20
  face=3D"Times New Roman"> <I>hdl</I> reads a line from the file=20
  or</FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><FONT size=3D3><FONT face=3D"Times =
New Roman">&nbsp;=20
  channel managed by <EM>hdl. </EM>The Prelude's <FONT face=3D"Courier =
New"=20
  size=3D2>getLine</FONT> is a shorthand</FONT></FONT></FONT></DIV>
  <DIV>&nbsp; for <FONT face=3D"Courier New"><FONT size=3D2>hGetLine=20
  stdin</FONT>.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; <EM>Error =
reporting</EM>: <FONT=20
  size=3D3><FONT face=3D"Times New Roman">the =
</FONT><TT>hWaitForInput</TT><FONT=20
  face=3D"Times New Roman">, </FONT><TT>hReady</TT><FONT face=3D"Times =
New Roman">=20
  and </FONT><TT>hGetChar</TT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><FONT size=3D3><TT>&nbsp;<FONT=20
  face=3D"Times New Roman"> </FONT></TT><FONT face=3D"Times New =
Roman">computations=20
  may fail with: </FONT><TT>isEOFError</TT><FONT face=3D"Times New =
Roman"> if the=20
  end of file has</FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><FONT size=3D3><FONT=20
  face=3D"Times New Roman">&nbsp;&nbsp; been =
reached.</FONT></FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; <FONT=20
  face=3D"Courier New">hGetLine</FONT> will also fail with <FONT=20
  face=3D"Courier New">isEOFError</FONT> if end-of-file is=20
encountered</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; when reading the =
<EM>first</EM>=20
  character of the line. If <FONT face=3D"Courier New">hGetLine</FONT>=20
  encounters</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; end-of-file at any other =
point while=20
  reading in a line, it is treated as</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; a line terminator and =
the (partial)=20
  line is returned.</FONT><FONT face=3DArial size=3D2></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3></FONT><FONT=20
  face=3DArial size=3D2></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Actually, I'd prefer if 11.7.1 only =
dealt with=20
  hWaitForInput and hReady</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>(as they're the "checking for input" =
operations).=20
  A second section,</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>named "Reading input", would then be =
concerned=20
  with hGetChar and</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>hGetLine.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT size=3D+0><FONT face=3DArial =
size=3D2>--sigbjorn</FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>----- Original Message ----- </FONT>
  <DIV><FONT face=3DArial size=3D2>From: "Simon Peyton-Jones" =
&lt;</FONT><A=20
  href=3D"mailto:simonpj@microsoft.com"><FONT face=3DArial=20
  size=3D2>simonpj@microsoft.com</FONT></A><FONT face=3DArial=20
  size=3D2>&gt;</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>To: "Sigbjorn Finne" &lt;</FONT><A=20
  href=3D"mailto:sof@glass.cse.ogi.edu"><FONT face=3DArial=20
  size=3D2>sof@glass.cse.ogi.edu</FONT></A><FONT face=3DArial =
size=3D2>&gt;;=20
  &lt;</FONT><A href=3D"mailto:simonmar@microsoft.com"><FONT =
face=3DArial=20
  size=3D2>simonmar@microsoft.com</FONT></A><FONT face=3DArial=20
  size=3D2>&gt;</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Sent: Tuesday, June 04, 2002 =
04:03</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Subject: RE: cvs commit: hugs98/lib =
IO.hs=20
  Prelude.hs</FONT></DIV></DIV>
  <DIV><FONT face=3DArial><BR><FONT size=3D2></FONT></FONT></DIV><FONT =
face=3DArial=20
  size=3D2>&gt; Should I change the Report wording to be =
clearer?<BR>&gt; <BR>&gt;=20
  Simon<BR>&gt; <BR>&gt; | -----Original Message-----<BR>&gt; | From: =
Sigbjorn=20
  Finne [mailto:sof@glass.cse.ogi.edu] <BR>&gt; | Sent: 03 June 2002=20
  15:49<BR>&gt; | To: </FONT><A =
href=3D"mailto:cvs-hugs@haskell.org"><FONT=20
  face=3DArial size=3D2>cvs-hugs@haskell.org</FONT></A><BR><FONT =
face=3DArial=20
  size=3D2>&gt; | Subject: cvs commit: hugs98/lib IO.hs =
Prelude.hs<BR>&gt; |=20
  <BR>&gt; | <BR>&gt; | =
sof&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  2002/06/03 07:49:12 PDT<BR>&gt; | <BR>&gt; |&nbsp;&nbsp; Modified=20
  files:<BR>&gt; |&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
lib&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  IO.hs Prelude.hs <BR>&gt; |&nbsp;&nbsp; Log:<BR>&gt; |&nbsp;&nbsp; =
Interpret=20
  Report wording for Prelude.getLine and IO.hGetLine<BR>&gt; =
|&nbsp;&nbsp; to=20
  mean the Right Thing. If EOF is encountered for a partial<BR>&gt;=20
  |&nbsp;&nbsp; line (&gt;=3D 1 chars), interpret this as '\n'.<BR>&gt;=20
  |&nbsp;&nbsp; <BR>&gt; |&nbsp;&nbsp; Revision&nbsp; =
Changes&nbsp;&nbsp;&nbsp;=20
  Path<BR>&gt; |&nbsp;&nbsp; 1.4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +25 =

  -8&nbsp;&nbsp;&nbsp;&nbsp; hugs98/lib/IO.hs<BR>&gt; |&nbsp;&nbsp;=20
  1.25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +23 -5&nbsp;&nbsp;&nbsp;&nbsp;=20
  hugs98/lib/Prelude.hs<BR>&gt; |=20
  _______________________________________________<BR>&gt; | Cvs-hugs =
mailing=20
  list<BR>&gt; | </FONT><A href=3D"mailto:Cvs-hugs@haskell.org"><FONT =
face=3DArial=20
  size=3D2>Cvs-hugs@haskell.org</FONT></A><FONT face=3DArial size=3D2> =
</FONT><A=20
  href=3D"http://www.haskell.org/mailman/listinfo/cvs-hugs"><FONT =
face=3DArial=20
  =
size=3D2>http://www.haskell.org/mailman/listinfo/cvs-hugs</FONT></A><BR><=
FONT=20
  face=3DArial size=3D2>&gt; |</FONT> </BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C20CB1.CACC1FB8--

--------------InterScan_NT_MIME_Boundary--