[commit: ghc] wip/nfs-locking: Add replaceSeparators to Util.hs. (d043ef5)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:17:29 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/d043ef595a7ee877d8c9659b27e592d361a110c6/ghc
>---------------------------------------------------------------
commit d043ef595a7ee877d8c9659b27e592d361a110c6
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Wed Dec 31 03:59:10 2014 +0000
Add replaceSeparators to Util.hs.
>---------------------------------------------------------------
d043ef595a7ee877d8c9659b27e592d361a110c6
src/Util.hs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/Util.hs b/src/Util.hs
index af23f27..68ed2e5 100644
--- a/src/Util.hs
+++ b/src/Util.hs
@@ -1,6 +1,6 @@
module Util (
module Data.Char,
- replaceIf, replaceEq,
+ replaceIf, replaceEq, replaceSeparators,
postProcessPackageData
) where
@@ -13,6 +13,9 @@ replaceIf p to = map (\from -> if p from then to else from)
replaceEq :: Eq a => a -> a -> [a] -> [a]
replaceEq from = replaceIf (== from)
+replaceSeparators :: String -> String
+replaceSeparators = replaceIf isPathSeparator
+
-- Prepare a given 'packaga-data.mk' file for parsing by readConfigFile:
-- 1) Drop lines containing '$'
-- 2) Replace '/' and '\' with '_' before '='
@@ -21,6 +24,6 @@ postProcessPackageData file = do
pkgData <- (filter ('$' `notElem`) . lines) <$> liftIO (readFile file)
length pkgData `seq` writeFileLines file $ map processLine pkgData
where
- processLine line = replaceIf isPathSeparator '_' prefix ++ suffix
+ processLine line = replaceSeparators '_' prefix ++ suffix
where
(prefix, suffix) = break (== '=') line
More information about the ghc-commits
mailing list