stats :: String -> String
stats =
unwords .
sequence [show . length . words,
show . length . lines,
show . length]
This improves the statistics code slightly, but uses some monadic
machinery you may not be familiar with. Another way to read the 'stats'
function is this:
stats :: String -> String
stats str =
unwords [show . length . words $ str,
show . length . lines $ str,
show . length $ str]