[Haskell-cafe] Re: [Haskell] Re: About Random Integer without IO

2004-11-12 Thread Graham Klyne
At 00:10 12/11/04 +0100, karczma wrote: But it was MUCH more important to repeat the same sequence, e.g., after making fast some nice fractal sketch, I relaunched the program with bigger size/precision, but exploiting the same random sequence. I repeat, such is my philosophy. I agree. I've used

Re: [Haskell-cafe] One-shot? (was: Global variables and stuff)

2004-11-12 Thread Graham Klyne
At 16:07 11/11/04 +, Keith Wansbrough wrote: Graham Klyne wrote: At 12:27 11/11/04 +, Ben Rudiak-Gould wrote: [..] going to be safe, because it's just not the case that x = once (newIORef ()) y = x has the same intended meaning as x = once (newIORef ()) y =

Re: [Haskell-cafe] Space efficiency problem

2004-11-12 Thread Ben Rudiak-Gould
Adrian Victor CRISCIU wrote: Thanks for the advice. However, though I don't know how ghc manages the heap, I am not sure it is possible to achieve constant heap usage, because a value of type State is a function, and = is creating a call stack in this case. I mean, I think that, even if the

[Haskell-cafe] Re: [Haskell] Re: About Random Integer without IO

2004-11-12 Thread Georg Martius
Hi, Sorry, but I don't really get the point of the discussion so far. I think any computation should be done in pure functional style, that gets a random generator (seed) and passes it around. Your program starts in the IO monad anyway, so you have the choice of using newStdGen to get a new

Re: [Haskell-cafe] One-shot? (was: Global variables and stuff)

2004-11-12 Thread Keith Wansbrough
So you say (and I do agree). But how can I *observe* that they are the same? Well, not with a single program run (obviously). But it is the case that for any program P and input sequence X (i.e., keys pressed): running P with X and running {foo = getChar; P'} with X (where P' is P with all

Re: [Haskell-cafe] One-shot? (was: Global variables and stuff)

2004-11-12 Thread Adrian Hey
On Thursday 11 Nov 2004 12:27 pm, Ben Rudiak-Gould wrote: On the other hand, these are perfectly safe: once' :: IO a - IO (IO a) oncePerString :: String - IO a - IO a oncePerType :: Typeable a = IO a - IO a once' seems virtually useless unless you have top-level -, but the

Re: [Haskell-cafe] One-shot? (was: Global variables and stuff)

2004-11-12 Thread Keean Schupke
Adrian Hey wrote: The latter is probably true, in a strict technical sense. But I can't see a way to live without them and keep modularity. In any case, I don't think there's any reason to force programmers wear the hair shirt in this respect (other than dogma and superstitious fear about the

Re: [Haskell-cafe] One-shot? (was: Global variables and stuff)

2004-11-12 Thread Robert Dockins
Should values really depend on the order of includes? Even if you limit things to just newChan in top level '-' you still don't know if A.a in B the same A.a in C. Perhaps it is enough to say A.a only exists once no matter how many times it is directly or indirectly imported? This strikes me

Re: [Haskell-cafe] One-shot? (was: Global variables and stuff)

2004-11-12 Thread Keean Schupke
This still has a problem. Lets say B implements some useful function that relies on A. Now also C implements some different useful function and also relies on A in its implementation. If there is only one A.a then using both B and C features in the same code will potentally break both B and C.

Re: [Haskell-cafe] One-shot? (was: Global variables and stuff)

2004-11-12 Thread Judah Jacobson
On Fri, 12 Nov 2004 14:53:33 +, Adrian Hey [EMAIL PROTECTED] wrote: On Thursday 11 Nov 2004 12:27 pm, Ben Rudiak-Gould wrote: On the other hand, these are perfectly safe: once' :: IO a - IO (IO a) oncePerString :: String - IO a - IO a oncePerType :: Typeable a = IO

Re: [Haskell-cafe] IO and State

2004-11-12 Thread Iavor S. Diatchki
Hello, Ben Rudiak-Gould wrote: ... I would say that the law holds in one direction and not the other. It's safe to replace do x - readSTRef r y - readSTRef r with do x - readSTRef r let y = x but not the other way around. How can things be equal the one way and not the other? I

Re: [Haskell-cafe] IO and State

2004-11-12 Thread Ben Rudiak-Gould
Iavor S. Diatchki wrote: Ben Rudiak-Gould wrote: I would say that the law holds in one direction and not the other. [...] How can things be equal the one way and not the other? Saying that two things are equal means (in this context) that either can be replaced by the other without changing the

Re: [Haskell-cafe] IO and State

2004-11-12 Thread Graham Klyne
At 10:35 10/11/04 -0800, Iavor S. Diatchki wrote: Hello, Concurrency in Haskell (technically GHC) is much like concurrency in other languages, in that you fork off threads and do stuff with them, etc. I think you are perhaps thinking of another kind of concurrency, where different redexes in a

Re: [Haskell-cafe] One-shot? (was: Global variables and stuff)

2004-11-12 Thread Adrian Hey
On Friday 12 Nov 2004 3:20 pm, Keean Schupke wrote: Adrian Hey wrote: The latter is probably true, in a strict technical sense. But I can't see a way to live without them and keep modularity. In any case, I don't think there's any reason to force programmers wear the hair shirt in this