Parsing IO [Int] to use the Int

Viewed 90

I am developing in Haskell and I had to use System.Random.

Now I have a IO [Int] and I would like to parse it to get the Int out of it and then use it to perform an action on a list.

I did:

function :: IO [Int] -> [a] -> a
function (x:xs) list = (list !! x)

But I get an error on (x:xs):

 Couldn't match expected type 'IO [Int]' with actual type '[a0]'.

How do I parse the IO [Int] to use the Int inside?

0 Answers
Related