
Brian Hulley wrote:
The use of a plain value to initialize the ref rather than a monadic computation would ensure that there would be no problems with trying to work out which order to initialize top level refs that are dependent on values of refs in other modules since there could be no dependencies.
I'm not sure what problem you see with the ACIO monad proposal. It was designed to prevent the kind of ordering dependency problems which (I think) you're refering to. You can't read or write IORefs/MVars or do any other "real IO" operation from ACIO. All you can do is create them (and more complex data structures based on them). So they could be evaluated at compile time, in principle (AFAICS etc..). I think it should also be possible to fork threads from ACIO, provided you arrange that they're initially blocked on an empty MVar or something. If it turns out that that isn't enough to properly initialise them (like you need to do real IO), then you just can't have them as top level identifiers. But you can still use something like the "oneShot" function to implement "get" actions at the top level (in the IO monad). Regards -- Adrian Hey