[Haskell-cafe] Convert IO Int to Int
iainspeed at gmail.com
Wed Jun 10 08:08:32 EDT 2009
On 10 Jun 2009, at 12:55 pm, ptrash wrote:
> Now I have tried to write a Method which gives me a Number of
> random numbers
> the same way but it doesn't work.
> randomList :: Int -> [Integer]
> randomList 0 = 
> randomList n = do
> r <- randomRIO (1, 10)
> It says Couldn't match expected type `IO t' against inferred type
> r <- randomRIO (1,10) causes an error. But why does it work on the
> Is there a way to solve it another way?
I had the same problem a while back, the thread is here
the console uses IO already, so it's not a problem there. I ended up
learning about the >>= operator, and that helped a lot. Anyway, lots
of helpful links in that mail thread.
More information about the Haskell-Cafe