
19 Nov
2002
19 Nov
'02
5:53 a.m.
At 2002-11-18 11:05, Sven Panne wrote:
global :: a -> IORef a global a = unsafePerformIO (newIORef a)
This is useful, you can do this with it:
ref = global Nothing
convert :: a -> IO b convert a = do writeIORef ref (Just a) Just b <- readIORef ref return b
This particular "flexibility" provided by unsafePerformIO is actually documented... http://www.haskell.org/ghc/docs/latest/html/base/System.IO.Unsafe.html#u nsafePerformIO Cheers, Simon
8219
Age (days ago)
8219
Last active (days ago)
0 comments
1 participants
participants (1)
-
Simon Marlow