[Haskell-cafe] Re: Hugs vs GHC (again) was: Re: Some randomnewbiequestions

Simon Marlow simonmar at microsoft.com
Tue Jan 11 08:04:44 EST 2005


On 11 January 2005 09:00, Sebastian Sylvan wrote:

> On Mon, 10 Jan 2005 17:12:44 -0000, Simon Marlow
> <simonmar at microsoft.com> wrote: 
> 
>> Not a problem.  Have you looked at the streams proposal?
>> 
> 
> I've missed most of the discussion on this, so if someone could just
> clarify the reasons for a few things I find peculiar:
> 
> * Prefixing function names with their types, not necessary with
> qualified imports.

I agree with this.

> * Why not put isEOS in the InputStream class since it doesn't make
> sense for OutputStreams?

I think so, and there's a comment to that effect in the prototype code.

> * Why not introduce an additional class BufferedStream containing the
> the Buffering-functions (instead of having them in Stream and
> resorting to weird failure-patterns for non-buffered streams):
> setBufferMode :: s -> BufferMode -> IO ()
> getBufferMode :: s -> IO BufferMode
> flush :: s -> IO ()
> sync :: s -> IO Bool
> Where setBufferMode is not allowed to "fail" (by returning False). If
> for some reason it does fail an exception is thrown. Same thing with
> getBufferMode. It will return a Buffering or throw an exception (not
> return "NoBuffering" instead of a failure).

The prototype code has a separate Buffered class, with TextOutputStream
an instance of it.  I've been wondering whether having a generic
buffering layer might be possible/desirable too, so you could do
buffered binary I/O.  Anyway, it would be good to record comments and
suggestions like this on the wiki page
(http://www.haskell.org/hawiki/HaskellStreamIO).

Cheers,
	Simon


More information about the Haskell-Cafe mailing list