Global variables

Douglas Philips dgou at mac.com
Thu Feb 1 12:11:55 EST 2007


On 2007 Feb 1, at 11:51 AM, David House indited:

> On 01/02/07, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
>> there is common proposal that i support. example of its use:
>>
>> i :: IORef Int
>> i <- newIORef 1
>>
>> with a semantics equivalent to current use of usafePerformIO 
>> +INLINE in GHC
>
> I think that's too safe-looking. Anything that translates to something
> involving unsafe* should be tagged with 'unsafe' somewhere as well.
> Also, as unsafe* is still compiler specific, I think a pragma is
> probably most appropriate:
>
> {-# GLOBAL-MUTVAR #-}
> i :: IORef Int
> i = unsafePerformIO (newIORef 1)

Hear hear!
As a Haskell newbie things are hard enough to keep straight without  
that kind of magical unsafe stuff going on.
Just sayin'

	--D'gou



More information about the Haskell-prime mailing list