aboutsummaryrefslogtreecommitdiff
path: root/lib/Distribution
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2018-10-14 01:37:46 +0200
committerDaniel Gröber <dxld@darkboxed.org>2018-10-27 19:53:16 +0200
commita355c72bd6be5fdbfeb3be843818922939d2f94a (patch)
tree2dd7af9e7df1c8e7262120fda7b052706c1a267c /lib/Distribution
parent8e5685ce57b296b7ba949173851a7f80c88e0ce2 (diff)
Add 'allUnits' convenience query
Diffstat (limited to 'lib/Distribution')
-rw-r--r--lib/Distribution/Helper.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs
index ad77eb3..4c51de2 100644
--- a/lib/Distribution/Helper.hs
+++ b/lib/Distribution/Helper.hs
@@ -46,6 +46,9 @@ module Distribution.Helper (
, UnitInfo(..)
, unitQuery
+ -- ** Convenience Queries
+ , allUnits
+
-- * Query environment
, QueryEnv -- abstract
, mkQueryEnv
@@ -268,7 +271,9 @@ projectUnits = Query $ \qe@QueryEnv{qeDistDir} ->
unitQuery :: Unit -> Query pt UnitInfo
unitQuery u = Query $ \qe -> getUnitInfo qe u
-
+-- | Get information on all units in a project.
+allUnits :: (UnitInfo -> a) -> Query pt [a]
+allUnits f = map f <$> (mapM unitQuery =<< projectUnits)
-- | Run @cabal configure@
reconfigure :: MonadIO m