
11 Aug
2006
11 Aug
'06
11:19 a.m.
John Meacham wrote:
data Dummy1 = Dummy1 intVar1 :: IORef Int intVar1 = unsafePerformIO (newIORef 0 `dependingOn` Dummy1)
data Dummy2 = Dummy2 intVar2 :: IORef Int intVar2 = unsafePerformIO (newIORef 0 `dependingOn` Dummy2)
normally, you would have to compile with -fno-cse to keep these two variables from being turned into one. however, since Dummy1 and Dummy2 will never be the same, the two terms cannot be considered the same by he optimizer so there is no problem.
I would like to see this in GHC. It's still an ugly hack but at least it's a better option than remembering to compile with -fno-cse IMO. I guess you still need the NOINLINE pragma too though. Regards -- Adrian Hey