title: Haskell store user input in array
body: <p>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.</p>
  
  <p>Unfortunately no matter what I try it doesn't work, here is my code:</p>
  
  <pre><code>-- Int Array
  intArray :: Int -&gt; IO [Int]
  intArray 0 = []
  intArray x = do
      str &lt;- getLine
      nextInt &lt;- intArray (x - 1)
      let int = read str :: Int
      return int:nextInt
  
  -- Main Function
  main = do
      array &lt;- intArray 5
      putStrLn (show array)
  </code></pre>