title: Handling complicated input (with nested values)
body: <p>There is the following task:</p>
  
  <ol>
  <li>First line is the number of cases</li>
  <li>For each case there is a line with the number of numbers to add</li>
  <li>For each case there is also a line with the numbers</li>
  <li>For each case I have to print summed numbers</li>
  </ol>
  
  <p>Example:</p>
  
  <pre><code>Input:
  2
  5
  1 2 3 4 5
  2
  -100 100
  
  Output:
  15
  0
  </code></pre>
  
  <p>This is my implementation</p>
  
  <pre><code>import Control.Monad
  
  main = do 
      linesCount &lt;- readLn :: IO Int
      numbers &lt;- replicateM linesCount getCase
      mapM_ putStrLn $ map (show.sum) numbers
  
  getCase :: IO [Int]
  getCase = do
      numbersCount &lt;- readLn :: IO Int -- actually I don't need this variable
      numbersString &lt;- getLine
      let numbers = map read $ words numbersString
      return numbers
  </code></pre>
  
  <p>It looks like a lot of code for parsing input. Are there any tricks to "compress" it? :)</p>