[commit: ghc] wip/nfs-locking: Move isLibrary to src/Package.hs, add isProgram. (5980218)

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


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

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

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

commit 598021809c6822f8c30b13ad0f75719a465a1c27
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Dec 21 03:00:38 2015 +0000

    Move isLibrary to src/Package.hs, add isProgram.


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

598021809c6822f8c30b13ad0f75719a465a1c27
 src/Package.hs  | 12 ++++++++++--
 src/Settings.hs |  4 ----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/Package.hs b/src/Package.hs
index 574f01a..5b04b6d 100644
--- a/src/Package.hs
+++ b/src/Package.hs
@@ -4,8 +4,8 @@ module Package (
     -- * Queries
     pkgCabalFile,
     matchPackageNames,
-    -- * Helpers for constructing 'Package's
-    setPath, topLevel, library, utility, setType
+    -- * Helpers for constructing and using 'Package's
+    setPath, topLevel, library, utility, setType, isLibrary, isProgram
     ) where
 
 import Base
@@ -48,6 +48,14 @@ setPath pkg path = pkg { pkgPath = path }
 setType :: Package -> PackageType -> Package
 setType pkg ty = pkg { pkgType = ty }
 
+isLibrary :: Package -> Bool
+isLibrary (Package {pkgType=Library}) = True
+isLibrary _ = False
+
+isProgram :: Package -> Bool
+isProgram (Package {pkgType=Program}) = True
+isProgram _ = False
+
 instance Show Package where
     show = pkgName
 
diff --git a/src/Settings.hs b/src/Settings.hs
index 7a1ab72..fd7c14c 100644
--- a/src/Settings.hs
+++ b/src/Settings.hs
@@ -32,10 +32,6 @@ getPkgDataList key = lift . pkgDataList . key =<< getTargetPath
 programPath :: Stage -> Package -> Maybe FilePath
 programPath = userProgramPath
 
-isLibrary :: Package -> Bool
-isLibrary (Package {pkgType=Library}) = True
-isLibrary _ = False
-
 -- Find all Haskell source files for the current target. TODO: simplify.
 getPackageSources :: Expr [FilePath]
 getPackageSources = do



More information about the ghc-commits mailing list