
8 Nov
2004
8 Nov
'04
7:23 a.m.
Adrian Hey wrote:
4- They already exist (stdin,stout,stderr) and I don't recall anybody ever complaining about this.
stdin, stdout, and stderr are not global variables. They are just handles. One possible implementation of handles is as an Int. So stdin is no more a global variable than 0. Of course you need some state associated with the handle, but that state does not have to be a unique global things. You are passing that state around via the IO monad, and there could be multiple versions of it. GHC chooses to implement it differently, but that's a choice. -- Lennart