09/07/23 23:01:29
>>554
import System.Environment (getArgs)
import System.IO
import Control.Exception (bracket)
main = do
[infile, outfile, n] <- getArgs
h <- openFile infile ReadMode
conn <- hGetContents h
let s = t554 (read n) conn
bracket (openFile outfile WriteMode) hClose $ flip hPutStr s
hClose h
t554 :: Int -> String -> String
t554 _ [] = []
t554 n ('\t':xs) = replicate n ' ' ++ t554 n xs
t554 n (x:xs) = x : t554 n xs