[Haskell-cafe] Re: Beginner: IORef constructor?

Benjamin Franksen benjamin.franksen at bessy.de
Mon Dec 4 21:00:05 EST 2006

Bernie Pope wrote:
> If you want a global variable then you can use something like:
>     import System.IO.Unsafe (unsafePerformIO)
>     global = unsafePerformIO (newIORef [])
> But this is often regarded as bad programming style (depends who you
> talk to). 

Besides, isn't this example /really/ unsafe? I thought, at least the IORef
has to be monomorphic or else type safety is lost?


More information about the Haskell-Cafe mailing list