main = do args <- getArgs
          text <- if length args > 0 then readFile $ head args
                 else getContents
          -- Process pairs into [(word, count)]
          let pairs = histogramPairs text
          let max_key_length = maximum $ map (length . fst) pairs
          let max_count = maximum $ map snd pairs
          -- And output results
          mapM_ (putStrLn . histogramLine max_key_length max_count) pairs
main = do args <- getArgs
          text <- if length args > 0 then readFile $ head args
                 else getContents
          -- Process pairs into [(word, count)]
          let pairs = histogramPairs text
          let max_key_length = maximum $ map (length . fst) pairs
          let max_count = maximum $ map snd pairs
          -- And output results
          mapM_ (putStrLn . histogramLine max_key_length max_count) pairs
main = do args <- getArgs
          text <- if length args > 0 then readFile $ head args
                 else getContents
          -- Process pairs into [(word, count)]
          let pairs = histogramPairs text
          let max_key_length = maximum $ map (length . fst) pairs
          let max_count = maximum $ map snd pairs
          -- And output results
          mapM_ (putStrLn . histogramLine max_key_length max_count) pairs