I have a basic function that accepts an Int and returns a list:
generateCode rnd =
[sharpOrDot i rnd | i <- [0..24]]
I call it from my main function like this:
do
r <- (randomIO :: IO Int)
generateCode r
Shouldn’t r <- (randomIO :: Int) “unpack” the Int part from IO Int and hence just pass a Int to generateCode?
It returns the error
Couldn't match expected type `IO a0' with actual type `[Char]'
Thanks
I think the last line must be
return (generateCode r). Else yourdo-block would “break out” of theIOmonad, which is impossible (well, without using the function with the name we don’t dare to speak out).