[Haskell-cafe] Re: Global Variables and IO initializers

2004-11-29 Thread George Russell
Benjamin wrote (snipped): Typeable would be completely safe if the only way to declare instances would be to derive them, but this is only practical if it can be done from anywhere outside the data type definition. Unfortunately this would also outlaw some legitimate uses of Typeable. In

[Haskell-cafe] Re: Global Variables and IO initializers

2004-11-25 Thread George Russell
Marcin wrote (snipped): I think global variables are a lot less evil if they behave as if they were dynamically scoped, like Lisp special variables. That is, there is a construct which gives the variable a new mutable binding visible in the given IO action. It's used more often than

[Haskell-cafe] Re: Global Variables and IO initializers

2004-11-24 Thread Benjamin Franksen
[encouraging everybody to reply on haskell-cafe] On Tuesday 23 November 2004 12:02, you wrote: Thanks to the encouraging post http://www.haskell.org//pipermail/haskell/2004-November/014748.html from Benjamin Franksen, I have implemented my proposal which allows the user to define new

Re: [Haskell-cafe] Re: Global Variables and IO initializers

2004-11-24 Thread Ben Rudiak-Gould
Benjamin Franksen wrote: label1 = unique Uniq1 label2 = unique Uniq2 global1 = functionalNewMVar label1 True global2 = functionalNewMVar label1 (117::Int) No dice. Your example inadvertently shows why: you used label1 when creating both global1 and global2, and now I can write

Re: [Haskell-cafe] Re: Global Variables and IO initializers

2004-11-24 Thread Benjamin Franksen
On Thursday 25 November 2004 01:14, Ben Rudiak-Gould wrote: Benjamin Franksen wrote: label1 = unique Uniq1 label2 = unique Uniq2 global1 = functionalNewMVar label1 True global2 = functionalNewMVar label1 (117::Int) No dice. Your example inadvertently shows why: you used

Re: [Haskell-cafe] Re: Global Variables and IO initializers

2004-11-24 Thread Ben Rudiak-Gould
Benjamin Franksen wrote: My god, what a stupid mistake. I should just give it up... :-( Funny you should say that, because I made the same mistake two weeks ago and felt the same way: http://www.haskell.org/pipermail/haskell-cafe/2004-November/007556.html Live and learn... -- Ben

Re: [Haskell-cafe] Re: Global Variables and IO initializers

2004-11-24 Thread Judah Jacobson
On Thu, 25 Nov 2004 01:46:03 +, Ben Rudiak-Gould [EMAIL PROTECTED] wrote: Benjamin Franksen wrote: My god, what a stupid mistake. I should just give it up... :-( Funny you should say that, because I made the same mistake two weeks ago and felt the same way:

[Haskell-cafe] Re: Global Variables and IO initializers

2004-11-09 Thread Henning Thielemann
On Mon, 8 Nov 2004, Keean Schupke wrote: For 'broken' libraries that cannot support multiple simultaneous contexts, it would be better to use the 'C' FFI based solution suggested by another poster. Ideally you would want to find a library with a better interface - If you tell me the library

[Haskell-cafe] Re: Global Variables and IO initializers

2004-11-09 Thread Ferenc Wagner
Henning Thielemann [EMAIL PROTECTED] writes: On Mon, 8 Nov 2004, Keean Schupke wrote: If you tell me the library you wish to use I may be able to suggest a better alternative. I'm using FFTW and PLPlot (but not with Haskell), both uses internal states and thus must be considered as ill

Re: [Haskell-cafe] Re: Global Variables and IO initializers

2004-11-09 Thread Henning Thielemann
On Tue, 9 Nov 2004, Ferenc Wagner wrote: Henning Thielemann [EMAIL PROTECTED] writes: On Mon, 8 Nov 2004, Keean Schupke wrote: If you tell me the library you wish to use I may be able to suggest a better alternative. I'm using FFTW and PLPlot (but not with Haskell), both uses

[Haskell-cafe] Re: Global Variables and IO initializers

2004-11-08 Thread Peter Simons
Adrian Hey writes: I don't see any value in problems that are specifically designed so that they can be solved only with a global entity. Even if it was true that I had specifically designed this problem, it's existance is of some interest I think. Perhaps my choice of words wasn't

Re: [Haskell-cafe] Re: Global Variables and IO initializers

2004-11-08 Thread jeff
Quoting Peter Simons [EMAIL PROTECTED]: Just ask the C++ folks about the wonders of global variables that are actually complex classes with a constructor and a destructor. You can't use that as an argument against global variables in other languages. -- Jeff

Re: [Haskell-cafe] Re: Global Variables and IO initializers

2004-11-08 Thread jeff
Quoting Peter Simons [EMAIL PROTECTED]: jeff writes: Just ask the C++ folks about the wonders of global variables that are actually complex classes with a constructor and a destructor. You can't use that as an argument against global variables in other languages. Why not? So