Re: [Haskell-cafe] Generate 50 random coordinates

2006-12-03 Thread Henning Thielemann
On Fri, 1 Dec 2006, Huazhi (Hank) Gong wrote: myrand :: Int myrand = randomRIO(1::Int, 100) concerning random and IO: http://haskell.org/haskellwiki/Things_to_avoid#Separate_IO_and_data_processing ___ Haskell-Cafe mailing list

[Haskell-cafe] Generate 50 random coordinates

2006-12-01 Thread Huazhi (Hank) Gong
Hello,all My intention is to generate 50 random coordinates like (x,y). myrand :: Int myrand = randomRIO(1::Int, 100) rf=[(myrand, myrand) | a - [1..50]] My short program is like this. However, GHCI say that the return type of randomRIO is IO a while the function defined by me is Int. Since I

Re: [Haskell-cafe] Generate 50 random coordinates

2006-12-01 Thread Taral
On 12/2/06, Huazhi (Hank) Gong [EMAIL PROTECTED] wrote: myrand :: Int myrand = randomRIO(1::Int, 100) rf=[(myrand, myrand) | a - [1..50]] do let myrand = randomRIO (1 :: Int, 100) rf - replicateM 50 (liftM2 (,) myrand myrand) -- Taral [EMAIL PROTECTED] You can't prove anything. --

Re: [Haskell-cafe] Generate 50 random coordinates

2006-12-01 Thread Donald Bruce Stewart
hankgong: Hello,all My intention is to generate 50 random coordinates like (x,y). myrand :: Int myrand = randomRIO(1::Int, 100) rf=[(myrand, myrand) | a - [1..50]] My short program is like this. However, GHCI say that the return type of randomRIO is IO a while the function defined

Re: [Haskell-cafe] Generate 50 random coordinates

2006-12-01 Thread Jason Dagit
Hello, On 12/1/06, Huazhi (Hank) Gong [EMAIL PROTECTED] wrote: Hello,all My intention is to generate 50 random coordinates like (x,y). myrand :: Int myrand = randomRIO(1::Int, 100) When we look at the type of randomRIO we see: randomRIO :: forall a. (Random a) = (a, a) - IO a You're