On Tue, Sep 05, 2000 at 01:10:07AM -0700, Simon Peyton-Jones wrote:

> Finalising the Haskell 98 report is (still) on my to-do list.  I
> plan to do it after ICFP, but I need a clear week which is why I've
> been procrastinating.  And comments do keep coming in occasionally.
> Manuel's is a case in point.

> I'd be interested to hear people's opinion about the lazy-file read
> question.  I'm not prepared to add new functions to Haskell 98, but
> I think the clarification of (1) or (2) below would be useful.  (2)
> is nice but it makes *all* file reading more expensive, perhaps
> significantly so (e.g. making a complete copy of the file).  So I am
> personally inclined to go for (1) and require Haskell programmers to
> do the consequent file-name changing themselves.

As a somewhat separate issue, the logic of half-closed, while it makes
sense for files, is somewhat bothersome for sockets.  If I read the
docs correctly, once I've grabed the contents lazily, I can no longer
write to the handle.  However, for some things I'd like to do with
sockets, this is a problem.

Case in point, consider a protocol where I recieve an XML request on a
socket, and from that generate a response.  Sure I can pull the XML
request in peice by peice using hGetLine (or whatever), such an
approach seems tedious.

I'd much rather do this:

   do contents <- hGetContents socket
      hPutStr socket (processXML contents)
      hClose socket

I can fake this (I think) with unsafeInterleaveIO, but I'd love to
have such behavior built in.

-- 
-- Jeffrey Straszheim              |  A sufficiently advanced
-- Systems Engineer, Programmer    |  regular expression is
-- http://www.shadow.net/~stimuli  |  indistinguishable from
-- stimuli AT shadow DOT net       |  magic

Reply via email to