[commit: ghc] wip/nfs-locking: Rules: Refactor generateTargets (c84445f)

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


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

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

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

commit c84445f81aafbe4089d860ae4a3e0c020a38b118
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sun Dec 20 20:49:29 2015 +0100

    Rules: Refactor generateTargets
    
    This previously used `fromJust`, which bottomed due to the recent
    `isLibrary` change.


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

c84445f81aafbe4089d860ae4a3e0c020a38b118
 src/Rules.hs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/Rules.hs b/src/Rules.hs
index 505b8a5..55ff066 100644
--- a/src/Rules.hs
+++ b/src/Rules.hs
@@ -10,12 +10,12 @@ generateTargets :: Rules ()
 generateTargets = action $ do
     targets <- fmap concat . forM [Stage0 ..] $ \stage -> do
         pkgs <- interpretWithStage stage getPackages
-        let (libPkgs, programPkgs) = partition isLibrary pkgs
+        let libPkgs = filter isLibrary pkgs
         libTargets <- fmap concat . forM libPkgs $ \pkg -> do
             let target = PartialTarget stage pkg
             needHaddock <- interpretPartial target buildHaddock
-            return $ [ pkgHaddockFile pkg | needHaddock && stage == Stage1 ]
-        let programTargets = map (fromJust . programPath stage) programPkgs
+            return [ pkgHaddockFile pkg | needHaddock && stage == Stage1 ]
+        let programTargets = [ prog | Just prog <- programPath stage <$> pkgs ]
         return $ libTargets ++ programTargets
     need $ reverse targets
 



More information about the ghc-commits mailing list