I am new to Haskell, also English is not my first language, so please do not rate this post down because of some typo or because the question is poorly formulated: for me this is a true struggle.
Anyway: I am trying to generate random coordinates (Int,Int)
and then use it in another Haskell function. But I have some problems "exporting" the IO-functions result to the second pure-kind Haskell function.
Here is an example that I think and hope properly illustrate my problem:
genRandomPair = genRandNr
genRandNr :: IO (Int,Int)
genRandNr = do
firstRandom <- randomRIO (1,10)
secondRandom <- randomRIO (1,10)
return (firstRandom,secondRandom)
If its not obvious it is the transgression from genRandNr
to genRandomPair
that is my problem.
I would be very thankful for all friendly input.
Please note: very advanced code will explanations won't really help me, since I am on a beginners level and until a week ago never worked with monads or IO in Haskell.