[commit: ghc] wip/nfs-locking: Simplify builderPath (058cb92)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 01:12:39 UTC 2017


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

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

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

commit 058cb92e8f1f21c271073d892d8b504726a345a2
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Oct 29 02:42:29 2016 +0100

    Simplify builderPath


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

058cb92e8f1f21c271073d892d8b504726a345a2
 src/Builder.hs | 11 +++--------
 src/GHC.hs     |  2 +-
 src/Package.hs |  1 -
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/Builder.hs b/src/Builder.hs
index c5dc9fb..61960c7 100644
--- a/src/Builder.hs
+++ b/src/Builder.hs
@@ -94,14 +94,9 @@ isOptional = \case
 
 -- | Determine the location of a 'Builder'.
 builderPath :: Builder -> Action FilePath
-builderPath builder = case builderProvenance builder of
-    Just context
-      | Just path <- programPath context -> return path
-      | otherwise                        ->
-        -- TODO: Make builderPath total.
-        error $ "Cannot determine builderPath for " ++ show builder
-             ++ " in context " ++ show context
-    Nothing -> case builder of
+builderPath builder = case programPath =<< builderProvenance builder of
+    Just path -> return path
+    Nothing   -> case builder of
         Alex          -> fromKey "alex"
         Ar            -> fromKey "ar"
         Cc  _  Stage0 -> fromKey "system-cc"
diff --git a/src/GHC.hs b/src/GHC.hs
index 2af8923..91987c6 100644
--- a/src/GHC.hs
+++ b/src/GHC.hs
@@ -86,7 +86,7 @@ unix                = library  "unix"
 win32               = library  "Win32"
 xhtml               = library  "xhtml"
 
--- | ghc-split is a perl script used by GHC with @-split-objs@ flag. It is
+-- | @ghc-split@ is a Perl script used by GHC with @-split-objs@ flag. It is
 -- generated in "Rules.Generators.GhcSplit".
 ghcSplit :: FilePath
 ghcSplit = "inplace/lib/bin/ghc-split"
diff --git a/src/Package.hs b/src/Package.hs
index bee5640..8a1a8d2 100644
--- a/src/Package.hs
+++ b/src/Package.hs
@@ -17,7 +17,6 @@ newtype PackageName = PackageName { fromPackageName :: String }
     deriving (Binary, Eq, Generic, Hashable, IsString, NFData, Ord, Typeable)
 
 -- TODO: Make PackageType more precise, #12.
--- TODO: Turn Program to Program FilePath thereby getting rid of programPath
 -- | We regard packages as either being libraries or programs. This is bit of a
 -- convenient lie as Cabal packages can be both, but it works for now.
 data PackageType = Library | Program deriving Generic



More information about the ghc-commits mailing list