[reactive] unsafePerformIO: is it correctly used?

Luke Palmer lrpalmer at gmail.com
Fri Nov 21 01:18:58 EST 2008

2008/11/20 Peter Verswyvelen <bugfact at gmail.com>:
> Now in Reactive, in e.g. the internal IVar.hs module, I see
> readIVar :: IVar a -> a
> readIVar (IVar v) = unsafePerformIO $ readMVar v
> At first sight this function is not following all the rules described above.
> Could this cause problems?

I cannot prove it formally, but I think it does not.  readMVar does
not have observable side-effects, assuming the MVar is never taken
(which is what IVar's abstraction ensures).


More information about the Reactive mailing list