[Haskell] Re: Global Variables and IO initializers

George Russell ger at informatik.uni-bremen.de
Thu Nov 4 12:54:04 EST 2004


John Peterson wrote (snipped):
 > The implementer of these functions has to guarantee that the
 > actions do not destroy the commutativity of the CIO monad.

Sorry, but several of my variable initialisation actions involve
things like starting up child processes or rapid exits from the program
if unsuccessful, which certainly cannot be guaranteed to be
commutative.

I still think the proposal I made to this list in June
    http://www.haskell.org//pipermail/haskell/2004-June/014104.html
is sound.  It requires nothing other than a new library, which is
trivial to implement using the existing unsafePerformIO.  It is
safe.  I don't think it's especially clunky.  Essentially the
only serious limitation is that you can only access a bit of
initialised state from an IO action, but in my experience at least
this is not a serious issue.

However virtually everyone seems to have their own patent solution,
and we are no closer to agreement.  Might it be an idea to have a Wiki
or something like that devoted to discussion of this problem, and we
can all try to agree on the advantages and disadvantages of the
competing methods?


More information about the Haskell mailing list