On Wed, 24 Jul 2002 10:44:51 +0100 (BST) "D. Tweed" <[EMAIL PROTECTED]> wrote:
> It wasn't clear to me whether Vincenzo's e-mail was saying that you > just needed to be in IO to generate the seed or that you need to be in > IO to do anything that involves generating random numbers __after > you've got the seed__. Since I have to admit I really dislike having > monads extend beyond the top couple of levels of a program I wanted to > point out that actually generating and using random numbers can be > done outside IO. Well, what I meant is that, being Haskell a lazy pure functional language, the *right* way to use I/O and nondeterminism in general is the IO monad. You can avoid it by using unsafeSomething but... it's unsafe. I like haskell the way it is. If one wants to write pure code using a random number generator created with newStdGen, which is in the IO monad, it's easy, he/she just writes a pure function "f" whose argument is a random number generator. And then the random number generator is created in the IO monad and "f" is applied to it. Vincenzo _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
