title: Cannot form a list of tuples in Haskell
body: <p>So my code tries to read pairs of <code>Int</code>s and turn them into a list:</p>
  
  <pre><code>import Control.Monad (forM, forM_)
  import Data.Function (on)
  import Data.List     (nub)
  
  main = do
      t &lt;- readLn
      forM_ [1..t] (\_ -&gt; do
          n &lt;- readLn
          points &lt;- forM [1..n] (\_ -&gt; do
              pointStr &lt;- getLine
              let [x, y] = map read $ words pointStr
              return (x, y))
          putStrLn $ if check points then "YES" else "NO")
  
  check :: [(Int, Int)] -&gt; Bool
  check points = ((==) `on` length) (nub $ map fst points) points
  </code></pre>
  
  <p>However, GHC complains that</p>
  
  <pre><code>   • Couldn't match type ‘(Int, Int)’ with ‘Int’
       Expected type: [Int]
         Actual type: [(Int, Int)]
     • In the second argument of ‘(==) `on` length’, namely ‘points’
       In the expression: ((==) `on` length) (nub $ map fst points) points
       In an equation for ‘check’:
         check points = ((==) `on` length) (nub $ map fst points) points
       |
    16 | check points = ((==) `on` length) (nub $ map fst points) points
       |                                                          ^^^^^^
  </code></pre>
  
  <p>I have tried to add a type declaration around <code>read</code>, but that doesn't work either. If I replace <code>return (x, y)</code> with <code>return x</code>, I get the same error. It seems like GHC recognizes <code>(x, y)</code> as an <code>Int</code>, rather than <code>(Int, Int)</code>.</p>
  
  <p>Any help?</p>