import Data.List;
replaceInString _ _ [] = [];
replaceString s1 s2 str@ (x:xs) = do {
if s1 `isPrefixOf` str then
s2 ++ (replaceString s1 s2 (drop (length s1) str))
else
x:(replaceString s1 s2 xs);
};
module Main where {
import Data.List;
replaceInString _ _ [] = [];
replaceString s1 s2 str@ (x:xs) =
if s1 `isPrefixOf` str then
s2 ++ (replaceString s1 s2 (drop (length s1) str))
else
x:(replaceString s1 s2 xs);
}
import Data.List
replaceString s1 s2 str =
let n = length s1
replaceString' [] = []
replaceString' str@(x:xs)
| s1 `isPrefixOf` str = s2 ++ replaceString' (drop n str)
| otherwise = x : replaceString' xs
in replaceString' str
import Data.List;
replaceString s1 s2 str =
let {n = length s1;
replaceString' [] = [];
replaceString' str@(x:xs)
| s1 `isPrefixOf` str = s2 ++ replaceString' (drop n str)
| otherwise = x : replaceString' xs }
in replaceString' str