I'm learning Haskell and I would like to have user input x numbers into the console and store those numbers in array which can be passed on to my functions.
Unfortunately no matter what I try it doesn't work, here is my code:
-- Int Array
intArray :: Int -> IO [Int]
intArray 0 = []
intArray x = do
str <- getLine
nextInt <- intArray (x - 1)
let int = read str :: Int
return int:nextInt
-- Main Function
main = do
array <- intArray 5
putStrLn (show array)