[Haskell] Re: Global Variables and IO initializers
ahey at iee.org
Sat Nov 6 12:52:27 EST 2004
On Saturday 06 Nov 2004 12:27 pm, Keean Schupke wrote:
> The problem I see here is how to proove the IO in safeIO is indeed
> safe. Perhaps "UnsafeIO" is a better name, as infact the IO is still
> unsafe -
I don't agree. All top level bindings currently have the property that
their value is independent of when they get reduced. If the only "IO"
primitives supported by the hypothetical SafeIO monad are the creation
of IORefs, MVars, etc how can this property be lost?
Bear in mind that reading or writing IORefs, MVars etc is forbidden.
Or is there some other essential property of top level bindings
you have in mind?
In this case we should really talk about "initial state" rather
than "value" I guess, hence the identity problem which you allude
> the compiler has to take special notice of this type and
> not inline its definitions.
> Your oneShot function has the same problem - if the compiler
> inlines the funtion you get two 'oneShot' functions.
Of course. The whole point of the proposed <- syntax is that it provides
an "official" and convenient way to tell the compiler _not_ to inline
and also apply typing restrictions (and not to do some other optimisations
too no doubt, such as CSE).
More information about the Haskell