[commit: ghc] wip/nfs-locking: Add docs, minor revision (b85602d)

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


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

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

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

commit b85602dc64ccb927839a2368b9636e2bd91cd232
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Wed Aug 16 23:15:34 2017 +0100

    Add docs, minor revision


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

b85602dc64ccb927839a2368b9636e2bd91cd232
 src/Hadrian/Haskell/Cabal.hs | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/Hadrian/Haskell/Cabal.hs b/src/Hadrian/Haskell/Cabal.hs
index b8f874c..d579de6 100644
--- a/src/Hadrian/Haskell/Cabal.hs
+++ b/src/Hadrian/Haskell/Cabal.hs
@@ -1,3 +1,14 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module     : Hadrian.Haskell.Cabal
+-- Copyright  : (c) Andrey Mokhov 2014-2017
+-- License    : MIT (see the file LICENSE)
+-- Maintainer : andrey.mokhov at gmail.com
+-- Stability  : experimental
+--
+-- Basic functionality for extracting Haskell package metadata stored in
+-- @.cabal@ files.
+-----------------------------------------------------------------------------
 module Hadrian.Haskell.Cabal (readCabal, cabalNameVersion, cabalDependencies) where
 
 import Development.Shake
@@ -8,28 +19,28 @@ import Distribution.Text
 import Distribution.Types.CondTree
 import Distribution.Verbosity
 
--- TODO: Track the values?
-
--- | Read a given @.cabal@ file and return the 'GenericPackageDescription'.
+-- | Read a given @.cabal@ file and return the 'GenericPackageDescription'. The
+-- @.cabal@ file is tracked.
 readCabal :: FilePath -> Action GenericPackageDescription
 readCabal cabal = do
     need [cabal]
     liftIO $ readGenericPackageDescription silent cabal
 
--- | Read a given @.cabal@ file and return the package name and version.
+-- | Read a given @.cabal@ file and return the package name and version. The
+-- @.cabal@ file is tracked.
 cabalNameVersion :: FilePath -> Action (String, String)
 cabalNameVersion cabal = do
     identifier <- package . packageDescription <$> readCabal cabal
     return (unPackageName $ pkgName identifier, display $ pkgVersion identifier)
 
--- | Read a given @.cabal@ file and return the package dependencies.
+-- | Read a given @.cabal@ file and return the package dependencies. The
+-- @.cabal@ file is tracked.
 cabalDependencies :: FilePath -> Action [String]
 cabalDependencies cabal = do
     gpd <- readCabal cabal
-    let depsLib  = collectDeps $ condLibrary gpd
-        depsExes = map (collectDeps . Just . snd) $ condExecutables gpd
-        deps     = concat $ depsLib : depsExes
-    return $ [ unPackageName name | Dependency name _ <- deps ]
+    let libDeps = collectDeps (condLibrary gpd)
+        exeDeps = map (collectDeps . Just . snd) (condExecutables gpd)
+    return [ unPackageName p | Dependency p _ <- concat (libDeps : exeDeps) ]
 
 collectDeps :: Maybe (CondTree v [Dependency] a) -> [Dependency]
 collectDeps Nothing = []



More information about the ghc-commits mailing list