blob: f20a6b867cf9718bc39306fddc1656f80b62799f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#!/usr/bin/env runhaskell
import Data.List(isPrefixOf)
import System(getArgs)
rep (c,r) [] = []
rep (c,r) f@(x:xs)
| c `isPrefixOf` f = r ++ rep (c,r) (drop (length c) f)
| otherwise = x:(rep (c,r) xs)
main = do
args <- getArgs
let [p',r'] = map (rep ("\\n","\n")) args
interact $ rep (p',r')
|