Global variables

Philippa Cowderoy flippa at
Thu Feb 1 11:57:53 EST 2007

On Thu, 1 Feb 2007, David House wrote:

> 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:
> i :: IORef Int
> i = unsafePerformIO (newIORef 1)

There might be a more sensible way to handle it while retaining the meat 
of Bulat's proposal, but I don't think it can really be done without 
making significant changes to the module system - it amounts to having 
initialiser actions, and once you've got those there're all sorts of 
things that rapidly become desirable. I've had a couple of occasions where 
being able to treat an entire module as being within a monad or an arrow 
could've been used to good effect though.

flippa at

"The reason for this is simple yet profound. Equations of the form
x = x are completely useless. All interesting equations are of the
form x = y." -- John C. Baez

More information about the Haskell-prime mailing list