[commit: ghc] wip/nfs-locking: Generalise and export suffix :: Way -> String. (1ef6a04)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:48:08 UTC 2017


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

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

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

commit 1ef6a045ba067a1f07b4517f11e7bfd2aa066e6e
Author: Andrey Mokhov <andrey.mokhov at ncl.ac.uk>
Date:   Wed Jan 7 17:44:04 2015 +0000

    Generalise and export suffix :: Way -> String.


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

1ef6a045ba067a1f07b4517f11e7bfd2aa066e6e
 src/Ways.hs | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/Ways.hs b/src/Ways.hs
index 0a4284a..3e7c483 100644
--- a/src/Ways.hs
+++ b/src/Ways.hs
@@ -13,6 +13,7 @@ module Ways (
     loggingDynamic, threadedLoggingDynamic,
 
     wayHcOpts, 
+    suffix,
     hisuf, osuf, hcsuf
     ) where
 
@@ -84,15 +85,11 @@ wayHcOpts (Way _ _ units) =
     , when (units == [Debug] || units == [Debug, Dynamic]) $ arg ["-ticky", "-DTICKY_TICKY"]
     ]
 
--- TODO: cover other cases
-suffix :: FilePath -> Way -> FilePath
-suffix base (Way _ _ units) = 
-    concat $
-        ["p_"   | Profiling `elem` units] ++
-        ["dyn_" | Dynamic   `elem` units] ++
-        [base                           ]
+suffix :: Way -> String
+suffix way | way == vanilla = ""
+           | otherwise      = tag way ++ "_"
 
-hisuf, osuf, hcsuf :: Way -> FilePath
-hisuf = suffix "hi"
-osuf  = suffix "o"
-hcsuf = suffix "hc"
+hisuf, osuf, hcsuf :: Way -> String
+hisuf = (++ "hi") . suffix
+osuf  = (++ "o" ) . suffix
+hcsuf = (++ "hc") . suffix



More information about the ghc-commits mailing list