dependingOn in 6.6

Adrian Hey ahey at
Fri Aug 11 11:19:55 EDT 2006

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.

Adrian Hey

More information about the Glasgow-haskell-users mailing list