Kevin Hammond <[EMAIL PROTECTED]> writes:
>
> Fergus Henderson has already partly addressed this.
> 
> What you want is allowed.  Although stdin *is* a constant, it's simply a
> constant that refers to a handle.  The handle information (file pointer,
> attached device etc.)
> needn't be constant.
> It's entirely consistent to provide, say:
> 
>         reconnect :: Handle -> Handle -> IO Handle
> 
> to connect one handle to the same device as another
> (as long as you're careful in the impl. about duplicating file pointers,
> which can
> get you into trouble -- new files are much easier to deal with!).
> This was actually one of the extensions that was considered fairly
> carefully in the
> I/O design.
> 

Hmm..this solution makes the assumption that you're working in
single-threaded environment or not using hGetContents - my proposal
deals with the situation where you have multiple processes (i.e.,
Concurrent Haskell) and want different actions/threads to have a
completely different idea of what stdin, stdout etc. is.

--Sigbjorn



Reply via email to