Re: [Haskell-cafe] so how does one convert an IO a into an a ?

2004-07-09 Thread Nicholas Nethercote
On Thu, 8 Jul 2004, John Kozak wrote: The root problem is that random number generation is inherently stateful, and so the familiar imperative idioms don't translate directly into a pure functional language. In a C-like language, each invocation of rand() mutates a secret piece of state lurking

Re: [Haskell-cafe] In relation to shuffling

2004-07-09 Thread Alastair Reid
[Warning: this message is going to talk about 'splitting supplies' and 'splitting random number generators'. The two sound quite similar and can be used to accomplish similar goals but are quite different in the way you write your code, in how repeatable the results, etc. so try not to confuse

Re: [Haskell-cafe] so how does one convert an IO a into an a ?

2004-07-09 Thread Paul Hudak
Judging from a previous message I'm not sure if you're still using SOE, but one of the things I tried to do is introduce IO without mentioning monads at all, and if you read chapter 3 (especially section 3.1) you will see that that's the case. To those who have had imperative programming

Re: [Haskell-cafe] state in the continuation monad...

2004-07-09 Thread Chung-chieh Shan
On 2004-07-02T16:15:15+0200, Ralf Laemmel wrote: I wonder whether perhaps a more basic step is to understand how type-changing monadic computations can be understood. By this I mean, that the effects model by the monad can change their type as part of the computation. Such a monad would be