diff options
-rw-r--r-- | CabalHelper/Common.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/CabalHelper/Common.hs b/CabalHelper/Common.hs index 391a842..37c217a 100644 --- a/CabalHelper/Common.hs +++ b/CabalHelper/Common.hs @@ -96,10 +96,11 @@ takeExtension' p = then "" -- just ".cabal" is not a valid cabal file else takeExtension p -replace n r h = go "" n r h +replace :: String -> String -> String -> String +replace n r hs' = go "" hs' where - go acc n r h + go acc h | take (length n) h == n = reverse acc ++ r ++ drop (length n) h - go acc n r (h:hs) = go (h:acc) n r hs - go acc n r [] = reverse acc + go acc (h:hs) = go (h:acc) hs + go acc [] = reverse acc |