title: Is there a getInt function on Haskell?
body: <p>I would like to have a <code>getInt :: IO Int</code> function on Haskell. It would be a function that would take an integer from <strong>stdin</strong>, leaving the rest of the buffer intact.</p>
  
  <p>The library function with this type I have found, <code>readLn :: IO Int</code>, for example, would not work with an input like:</p>
  
  <pre><code>2
  3 4
  </code></pre>
  
  <p>Because it would take the entire line <code>3 4</code>, instead of taking <code>3</code> and leaving <code>4</code> for the next <code>getInt</code>. Although I know I could read the complete string and then split it using <code>words</code>, I would like to ask if there is a way which does not consume the buffer.</p>
  
  <p>Is there any function on the standard libraries doing this? Is there any simple/obvious way to create a <code>getInt</code> I am missing?</p>