unsafePerformIO safety.

David Brown haskell2 at davidb.org
Tue Mar 6 15:03:05 EST 2007


I've noticed quite a few pages referencing constructs such as:

  var :: MVar ([Foo])
  var = unsafePerformIO (newMVar ([]))

and the likes.  Is there a danger of different uses of 'var' getting
new MVars instead of all sharing one.

Having a reliable way to create a piece of global state would be very
convenient.

Dave



More information about the Glasgow-haskell-users mailing list