Re: Global variables?

2003-02-02 Thread Richard Uhtenwoldt
Andrew J Bromage writes: >> John Hughes wrote a nice pearl on the subject, see >> >> http://www.math.chalmers.se/~rjmh/Globals.ps > >Nice! I do not think it is nice: I do not like any of the solutions Hughes considers in that paper because this problem can be handled much more simply with

Re: Global variables?

2003-02-02 Thread Jon Cast
Fergus Henderson <[EMAIL PROTECTED]> wrote: > On 02-Feb-2003, Jon Cast <[EMAIL PROTECTED]> wrote: > > Claus Reinke <[EMAIL PROTECTED]> wrote: > > > It is the programmer's responsibility to verify that none of these > > > problems matter in the particular case of usage. Since many > > > advances in

Re: Global variables?

2003-02-02 Thread Fergus Henderson
On 02-Feb-2003, Jon Cast <[EMAIL PROTECTED]> wrote: > Claus Reinke <[EMAIL PROTECTED]> wrote: > > It is the programmer's responsibility to verify that none of these > > problems matter in the particular case of usage. Since many advances > > in compiler technology tend to invalidate those verificat

Re: Global variables?

2003-02-02 Thread Jon Cast
Claus Reinke <[EMAIL PROTECTED]> wrote: > > > > import IORef > > > > import IOExts > > > > > > > > globalVar :: IORef Int > > > > globalVar = unsafePerformIO $ newIORef 0 > > > John Hughes wrote a nice pearl on the subject, see > > > http://www.math.chalmers.se/~rjmh/Globals.ps > > This paper cl

Re: Global variables?

2003-02-02 Thread Jon Cast
Andrew J Bromage <[EMAIL PROTECTED]> wrote: > G'day all. > On Fri, Jan 31, 2003 at 01:54:26PM -0600, Jon Cast wrote: > > Otherwise, though, see my other post on this subject: > > unsafePerformIO will perform its action when the variable is > > accessed, so you can't write a Haskell program which

Re: Global variables?

2003-02-02 Thread Jon Cast
Patrik Jansson <[EMAIL PROTECTED]> wrote: > On Fri, 31 Jan 2003, Jon Cast wrote: > > Otherwise, though, see my other post on this subject: > > unsafePerformIO will perform its action when the variable is > > accessed, so you can't write a Haskell program which differentiates > > between what any co

Re: Problem with backtracking monad transformer

2003-02-02 Thread Andrew J Bromage
G'day all. On Fri, Jan 31, 2003 at 09:05:11AM -, Guest, Simon wrote: > This bit I don't understand. I only have one monad transformer, which I use to > transform my SM monad. What I mean is (and recall that I have not looked very hard at your program, just the BACKTR implementation, so I'm

Re: Global variables?

2003-02-02 Thread Andrew J Bromage
G'day all. On Fri, Jan 31, 2003 at 01:54:26PM -0600, Jon Cast wrote: > Otherwise, though, see my other post on this subject: unsafePerformIO > will perform its action when the variable is accessed, so you can't > write a Haskell program which differentiates between what any compiler > actually do

Re: Global variables?

2003-02-02 Thread Andrew J Bromage
G'day all. On Fri, Jan 31, 2003 at 09:08:22AM +0100, Ralf Hinze wrote: > John Hughes wrote a nice pearl on the subject, see > > http://www.math.chalmers.se/~rjmh/Globals.ps Nice! Why isn't RefMonad in hslibs? Possibly because of the class signature: class Monad m => RefMonad m

Re: Global variables?

2003-02-02 Thread Claus Reinke
> > > import IORef > > > import IOExts > > > > > > globalVar :: IORef Int > > > globalVar = unsafePerformIO $ newIORef 0 > > John Hughes wrote a nice pearl on the subject, see > > > http://www.math.chalmers.se/~rjmh/Globals.ps > > This paper claims ``unsafePerformIO is unsafe''. That's not act

Re: Global variables?

2003-02-02 Thread Patrik Jansson
On Fri, 31 Jan 2003, Jon Cast wrote: > Otherwise, though, see my other post on this subject: unsafePerformIO > will perform its action when the variable is accessed, so you can't > write a Haskell program which differentiates between what any compiler > actually does and running the variable alloca