Jules Bean <[EMAIL PROTECTED]> writes: > I think what people are trying to suggest is an 'initialization > phase' in the IO monad, which takes place "before" the pure > functions are defined.
If it was done before, what could you use to specify initial value of such a variable? Only literals? Constructors? Named constants? Results of arithmetic operations? Results of arbitrary functions? The well-definedness of a global IORef relies on the fact that creation of an IORef doesn't have visible side effects, so it doesn't matter when it happens, as long as it happens once between the variable is used. An arbitrary IO computation doesn't have this property. Unfortunately having only IORefs would be limiting. You couldn't legally make stdin/stdout/stderr for example. Now they must rely on compiler magic for something which doesn't seem to need magic by nature (allocation of some MVars and other objects, not doing actual I/O). -- __("< Marcin Kowalczyk \__/ [EMAIL PROTECTED] ^^ http://qrnik.knm.org.pl/~qrczak/ _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell