aboutsummaryrefslogtreecommitdiff
path: root/lib/Distribution/Helper.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2019-07-30 20:35:00 +0200
committerDaniel Gröber (dxld) <dxld@darkboxed.org>2019-09-17 17:48:26 +0200
commita59d7b1f56ff7d206bbddcd3647ab39e46a7c4aa (patch)
tree0fd3ad05e9c00e9a7ef1f9ff6c1bb151435db1b3 /lib/Distribution/Helper.hs
parent99140dbf830caac283385389e383b816a0946462 (diff)
Update API docs of main types
Diffstat (limited to 'lib/Distribution/Helper.hs')
-rw-r--r--lib/Distribution/Helper.hs22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs
index b72fd2a..c290d41 100644
--- a/lib/Distribution/Helper.hs
+++ b/lib/Distribution/Helper.hs
@@ -46,6 +46,7 @@ module Distribution.Helper (
-- ** Unit queries
, Unit -- abstract
, uComponentName
+ , uPackageDir
, UnitId -- abstract
, UnitInfo(..)
, unitInfo
@@ -80,7 +81,7 @@ module Distribution.Helper (
, CompPrograms(..)
, defaultCompPrograms
- -- * Result types
+ -- * Query result types
, ChComponentInfo(..)
, ChComponentName(..)
, ChLibraryName(..)
@@ -92,16 +93,15 @@ module Distribution.Helper (
-- * General information
, Distribution.Helper.buildPlatform
- -- * Stuff that cabal-install really should export
+ -- * Legacy v1-build helpers
, Distribution.Helper.getSandboxPkgDb
- -- * Managing @dist/@
+ -- * Stateful helper actions
, prepare
, writeAutogenFiles
) where
import Cabal.Plan hiding (Unit, UnitId, uDistDir)
-import Control.Arrow (first)
import Control.Applicative
import Control.Monad
import Control.Monad.Trans.Maybe
@@ -168,8 +168,8 @@ import Distribution.Simple.GHC as GHC (configure)
-- accessor of 'QueryEnv' for details.
--- | A lazy, cached, query against a package's Cabal configuration. Use
--- 'runQuery' to execute it.
+-- | A query against a package's Cabal configuration. Use 'runQuery' to
+-- execute it.
newtype Query pt a = Query
{ runQuery :: QueryEnv pt -> IO a
-- ^ @runQuery env query@. Run a 'Query' under a given 'QueryEnv.
@@ -560,13 +560,21 @@ invokeHelper
-- | Make sure the appropriate helper executable for the given project is
-- installed and ready to run queries.
+--
+-- The idea is you can run this at a convinient time instead of having the
+-- helper compilation happen during a time-sensitive user
+-- interaction. @caba-helper@ will however do this automatically as needed
+-- if you don't.
prepare :: QueryEnv pt -> IO ()
prepare qe = do
proj_info <- getProjInfo qe
void $ getHelper proj_info qe
--- | Create @cabal_macros.h@ and @Paths_\<pkg\>@ possibly other generated files
+-- | Create @cabal_macros.h@, @Paths_\<pkg\>.hs@ and other generated files
-- in the usual place. See 'Distribution.Simple.Build.initialBuildSteps'.
+--
+-- This is usually only needed on the first load of a unit or after the
+-- cabal file changes.
writeAutogenFiles :: Unit pt -> Query pt ()
writeAutogenFiles unit = Query $ \qe -> do
proj_info <- getProjInfo qe