From a355c72bd6be5fdbfeb3be843818922939d2f94a Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sun, 14 Oct 2018 01:37:46 +0200 Subject: Add 'allUnits' convenience query --- lib/Distribution/Helper.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3