import System main = do (f1:_) <- getArgs s <- readFile f1 putStr (prettierwc s) wc s = (length (lines s), length (words s), length s) prettywc s = "Lines: " ++ show l ++ "\nWords: " ++ show w ++ "\nCharss: " ++ show c ++ "\n" where (l,w,c) = wc s --- rjustify :: Int -> String -> String rjustify width s = take (width - length s) (repeat ' ') ++ s --- prettierwc s = "Lines: " ++ rjustify 6 (show l) ++ "\n" ++ "Words: " ++ rjustify 6 (show w) ++ "\n" ++ "Chars: " ++ rjustify 6 (show c) ++ "\n" where (l,w,c) = wc s