[commit: ghc] wip/nfs-locking: Add comments. (c928f2c)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:06:26 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/c928f2ce774091b7a6345c5c3cbdf05782bb2d23/ghc

>---------------------------------------------------------------

commit c928f2ce774091b7a6345c5c3cbdf05782bb2d23
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Aug 22 21:08:19 2015 +0100

    Add comments.


>---------------------------------------------------------------

c928f2ce774091b7a6345c5c3cbdf05782bb2d23
 src/Base.hs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Base.hs b/src/Base.hs
index 862c46b..13483ce 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -50,15 +50,17 @@ packageDependencies :: FilePath
 packageDependencies = shakeFilesPath ++ "package-dependencies"
 
 -- Utility functions
-replaceIf :: (a -> Bool) -> a -> [a] -> [a]
-replaceIf p to = map (\from -> if p from then to else from)
-
+-- Find and replace all occurrences of a value in a list
 replaceEq :: Eq a => a -> a -> [a] -> [a]
 replaceEq from = replaceIf (== from)
 
+-- Find and replace all occurrences of path separators in a String with a Char
 replaceSeparators :: Char -> String -> String
 replaceSeparators = replaceIf isPathSeparator
 
+replaceIf :: (a -> Bool) -> a -> [a] -> [a]
+replaceIf p to = map (\from -> if p from then to else from)
+
 -- Given a module name extract the directory and file names, e.g.:
 -- decodeModule "Data.Functor.Identity" = ("Data/Functor/", "Identity")
 decodeModule :: String -> (FilePath, String)



More information about the ghc-commits mailing list