[commit: ghc] wip/nfs-locking: Rewrite digest, avoid using list (to avoid a shadow warning), and avoid using head (partial function) (02ec50d)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:05:35 UTC 2017


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

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

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

commit 02ec50d957a3ebd736ccb631795489eec971d528
Author: Neil Mitchell <ndmitchell at gmail.com>
Date:   Sat Jan 9 21:46:36 2016 +0000

    Rewrite digest, avoid using list (to avoid a shadow warning), and avoid using head (partial function)


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

02ec50d957a3ebd736ccb631795489eec971d528
 src/Rules/Actions.hs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index 51f7625..338bec3 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -132,7 +132,6 @@ putInfo (Target.Target {..}) = putBuild $ renderBox
   where
     stageInfo = if isStaged builder then "" else "stage = " ++ show stage ++ ", "
     wayInfo   = if way == vanilla   then "" else ", way = " ++ show way
-    digest list = case list of
-        []  -> "none"
-        [x] -> x
-        xs  -> head xs ++ " (and " ++ show (length xs - 1) ++ " more)"
+    digest [] = "none"
+    digest [x] = x
+    digest (x:xs) = x ++ " (and " ++ show (length xs) ++ " more)"



More information about the ghc-commits mailing list