[commit: ghc] wip/nfs-locking: Add replaceChar helper function. (1fa4aa5)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:16:25 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/1fa4aa517a6e1334b276539204b41367fbff8a51/ghc
>---------------------------------------------------------------
commit 1fa4aa517a6e1334b276539204b41367fbff8a51
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Tue Dec 30 03:52:56 2014 +0000
Add replaceChar helper function.
>---------------------------------------------------------------
1fa4aa517a6e1334b276539204b41367fbff8a51
src/Base.hs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/Base.hs b/src/Base.hs
index b4ea8cb..eaebaf3 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -10,6 +10,7 @@ module Base (
Args, arg,
joinArgs, joinArgsWithSpaces,
filterOut,
+ replaceChar
) where
import Development.Shake hiding ((*>))
@@ -42,3 +43,8 @@ joinArgs = intercalateArgs ""
filterOut :: Args -> [String] -> Args
filterOut args list = filter (`notElem` list) <$> args
+
+replaceChar :: Char -> Char -> String -> String
+replaceChar from to = (go from) . if from == '/' then go '\\' else id
+ where
+ go from' = map (\c -> if c == from' then to else c)
More information about the ghc-commits
mailing list