I’m reading in several lines from the input that the user has to type:
main :: IO ()
main = do
  let size = 3
  arr <- replicateM size getLine
  let pairs = map parsePair arr
  print pairs
Why am I allowed to do map parsePair arr on a separate line
but not on the same line, like this:
arr <- map parsePair (replicateM size getLine)
Doing so, I get the error :
• Couldn't match type ‘[]’ with ‘IO’
  Expected type: IO [Int]
    Actual type: [[Int]]
To give you more details, here is parsePair:
parsePair string = map parseInt $ words string
parseInt :: String -> Int
parseInt s = read s :: Int