Simon,
>PS. I'm less steamed up about the stdin issue; but I think you missed
>Sigbjorn's point. Yes stdin is a constant now, but he'd like stdin *not* to
>be a constant, so that he could take a value of type IO () that used stdin,
>and reconnect its stdin to (say) a file.
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.
Note that this isn't quite the same situation as with argv, since the only
way you
can use stdin is through monadic operations. Consequently there is
absolutely no problem with ref. transp.
I'll reserve comment on argv for now.
Regards,
Kevin
----------
Division of Computer Science, Tel: +44-1334 463241 (Direct)
School of Mathematical Fax: +44-1334 463278
and Computational Sciences, URL:
http://www.dcs.st-and.ac.uk/~kh/kh.html
University of St. Andrews, Fife, KY16 9SS.