[commit: ghc] wip/nfs-locking: Get rid of partial functions. (fa57784)

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


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

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

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

commit fa57784081e696d90b305601b9cfd960841f082c
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Thu May 5 03:24:45 2016 +0100

    Get rid of partial functions.


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

fa57784081e696d90b305601b9cfd960841f082c
 src/Rules/Libffi.hs | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/Rules/Libffi.hs b/src/Rules/Libffi.hs
index 17067ad..424b552 100644
--- a/src/Rules/Libffi.hs
+++ b/src/Rules/Libffi.hs
@@ -76,17 +76,18 @@ libffiRules = do
             createDirectory $ buildRootPath -/- stageString Stage0
 
             tarballs <- getDirectoryFiles "" ["libffi-tarballs/libffi*.tar.gz"]
-            when (length tarballs /= 1) $
-                 putError $ "libffiRules: exactly one libffi tarball expected"
-                              ++ "(found: " ++ show tarballs ++ ")."
+            tarball  <- case tarballs of
+                [file] -> return $ unifyPath file
+                _      -> putError $ "libffiRules: exactly one tarball expected"
+                          ++ "(found: " ++ show tarballs ++ ")."
 
-            need tarballs
-            let libname = dropExtension . dropExtension . takeFileName $ head tarballs
+            need [tarball]
+            let libname = dropExtension . dropExtension $ takeFileName tarball
 
             removeDirectory (buildRootPath -/- libname)
             -- TODO: Simplify.
             actionFinally (do
-                build $ Target libffiContext Tar tarballs [buildRootPath]
+                build $ Target libffiContext Tar [tarball] [buildRootPath]
                 moveDirectory (buildRootPath -/- libname) libffiBuildPath) $
                     removeFiles buildRootPath [libname <//> "*"]
 



More information about the ghc-commits mailing list