
18 Nov
2002
18 Nov
'02
2:05 p.m.
On Mon, Nov 18, 2002 at 10:36:05AM -0800, Hal Daume III wrote:
You can't. CSE (common subexpression elimination) will replace any occurances of 'newState 0' in a function body with the same value.
In short: don't use upIO :)
Sorry, cannot resist to pour a little salt onto the wound :) [232]% grep global ghc/compiler/utils/Util.lhs , global global :: a -> IORef a global a = unsafePerformIO (newIORef a) [233]% ghc/compiler/HsVersions.h: [...] #ifdef __GLASGOW_HASKELL__ #define GLOBAL_VAR(name,value,ty) \ name = Util.global (value) :: IORef (ty); \ {-# NOINLINE name #-} #endif [237]% grep -r GLOBAL_VAR ghc/compiler | wc -l 90 Muahahah... ;-P Cheers, Michael