Re: [Haskell] Re: Global Variables and IO initializers
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?
On Thursday 04 November 2004 18:54, George Russell wrote:
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.
The idea looks good to me. Do you have a prototype implementation? Ben
On Thursday 04 Nov 2004 5:54 pm, George Russell wrote:
However virtually everyone seems to have their own patent solution, and we are no closer to agreement.
FWIW, what Koen describes is exactly what I want (I think :-). So there's at least 2 votes for the "non-IO" monad approach, provided there's an escape to IO monad (typically needed for FFI related initialisations). I also think we need something like.. CIOtoIO :: CIO a -> IO a so that CIO constructors can be used normal IO code too. Regards -- Adrian Hey
participants (3)
-
Adrian Hey -
Benjamin Franksen -
George Russell