Some functions in the Prelude can be of help. One is map
, which allows you to write a simpler handleFizzBuzz
. Another is unwords
, which is equivalent to your concatOutput
.
handleFizzBuzz :: String -> String
handleFizzBuzz =
concatOutputmap $ unwords . fizzBuzz . convertInputLine
main :: IO ()
main = do
args <- getArgs
let path = args !! 0
file <- readFile path
putStrLn . unlines . handleFizzBuzz . lines $ file
Another is unwords
, which is equivalent to your concatOutput
.