Skip to content

Commit

Permalink
Add util function allBuildInfo :: PackageDescription -> [BuildInfo]
Browse files Browse the repository at this point in the history
The 'BuildInfo' for the library (if there is one and it's buildable)
and all the buildable executables. Useful for gathering dependencies.
  • Loading branch information
dcoutts committed Aug 31, 2007
1 parent a4f4729 commit 24a5f7d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Distribution/PackageDescription.hs
Expand Up @@ -75,6 +75,7 @@ module Distribution.PackageDescription (
BuildInfo(..),
emptyBuildInfo,
mapBuildInfo,
allBuildInfo,

-- ** Supplementary build information
HookedBuildInfo,
Expand Down Expand Up @@ -614,6 +615,16 @@ mapBuildInfo f pkg = pkg {
emptyBuildInfo :: BuildInfo
emptyBuildInfo = nullBuildInfo { hsSourceDirs = [currentDir] }

-- | The 'BuildInfo' for the library (if there is one and it's buildable) and
-- all the buildable executables. Useful for gathering dependencies.
allBuildInfo :: PackageDescription -> [BuildInfo]
allBuildInfo pkg_descr = [ bi | Just lib <- [library pkg_descr]
, let bi = libBuildInfo lib
, buildable bi ]
++ [ bi | exe <- executables pkg_descr
, let bi = buildInfo exe
, buildable bi ]

-- see comment at libFillInDefaults
biFillInDefaults :: BuildInfo -> BuildInfo
biFillInDefaults bi =
Expand Down

0 comments on commit 24a5f7d

Please sign in to comment.