title: Non-exhaustive patterns in lambda
body: <p>I am getting Non-exhaustive patterns in lambda. I am not sure of the cause yet. Please anyone how to fix it. The code is below:</p>
  
  <pre><code>import Control.Monad
  import Data.List
  time_spent h1 h2 = max (abs (fst h1 - fst h2)) (abs (snd h1 - snd h2))
  meeting_point xs = foldl' (find_min_time) maxBound xs
  where
      time_to_point p = foldl' (\tacc p' -&gt; tacc + (time_spent p p')) 0 xs
      find_min_time min_time p = let x = time_to_point p in if x &lt; min_time  then x else min_time
  
  main = do
    n &lt;- readLn :: IO Int
    points &lt;- fmap (map (\[x,y] -&gt; (x,y)) . map (map (read :: String-&gt;Int)) . map words . lines) getContents
    putStrLn $ show $ meeting_point points
  </code></pre>