Ketil Malde <[EMAIL PROTECTED]> writes:
> It seemed to me, though, that streams are related to channels,
I'm not sure what exactly do you mean by streams (because they are
only being designed), but differences are:
- A stream is either an input stream or an output stream, while a
single channel supports reading from one end and writing to the
other end.
- A stream passes around bytes, which are usually grouped in blocks
for efficiency. A channel is polymorphic wrt. the element type and
elements are always processed one by one.
- A stream may be backed by an OS file, pipe, socket etc., while
a channel exists purely in Haskell.
- A channel is never closed. Reading more data than have been put
blocks until someone puts more data. A stream can reach its end,
which is a condition a reader can detect. A stream backed by a pipe
is similar to a channel of bytes in that the reader blocks until
someone puts more data, but it can be closed too, which causes the
reader to observe end of file. A writer to a stream can block too
when the internal buffer in the kernel is full.
- A stream can be inherited by child processes, and it generally
continues to work by being linked to the same data sink or source as
before. A channel is inherited as a whole: there is no communication
between the two versions of the channel in the two processes.
--
__("< Marcin Kowalczyk
\__/ [EMAIL PROTECTED]
^^ http://qrnik.knm.org.pl/~qrczak/
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe