Skip to content

Commit 33b687e

Browse files
committed
add a bunch of HasCallStack
1 parent d1ef721 commit 33b687e

File tree

11 files changed

+50
-22
lines changed

11 files changed

+50
-22
lines changed

Cabal-syntax/src/Distribution/Compat/Graph.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ import qualified Data.Map.Strict as Map
106106
import qualified Data.Set as Set
107107
import qualified Data.Tree as Tree
108108
import qualified Distribution.Compat.Prelude as Prelude
109+
import GHC.Stack (HasCallStack)
109110

110111
-- | A graph of nodes @a@. The nodes are expected to have instance
111112
-- of class 'IsNode'.
@@ -379,7 +380,7 @@ fromMap m =
379380
bounds = (0, Map.size m - 1)
380381

381382
-- | /O(V log V)/. Convert a list of nodes (with distinct keys) into a graph.
382-
fromDistinctList :: (IsNode a, Show (Key a)) => [a] -> Graph a
383+
fromDistinctList :: HasCallStack => (IsNode a, Show (Key a)) => [a] -> Graph a
383384
fromDistinctList =
384385
fromMap
385386
. Map.fromListWith (\_ -> duplicateError)

Cabal/src/Distribution/Backpack/ComponentsGraph.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import Distribution.Utils.Generic
2323

2424
import Distribution.Pretty (pretty)
2525
import Text.PrettyPrint
26+
import GHC.Stack (HasCallStack)
2627

2728
------------------------------------------------------------------------------
2829
-- Components graph
@@ -50,7 +51,8 @@ dispComponentsWithDeps graph =
5051
-- | Create a 'Graph' of 'Component', or report a cycle if there is a
5152
-- problem.
5253
mkComponentsGraph
53-
:: ComponentRequestedSpec
54+
:: HasCallStack
55+
=> ComponentRequestedSpec
5456
-> PackageDescription
5557
-> Either [ComponentName] ComponentsGraph
5658
mkComponentsGraph enabled pkg_descr =

Cabal/src/Distribution/Backpack/Configure.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ import qualified Data.Map as Map
5555
import qualified Data.Set as Set
5656
import Distribution.Pretty
5757
import Text.PrettyPrint
58+
import GHC.Stack (HasCallStack)
5859

5960
------------------------------------------------------------------------------
6061
-- Pipeline
6162
------------------------------------------------------------------------------
6263

6364
configureComponentLocalBuildInfos
64-
:: Verbosity
65+
:: HasCallStack
66+
=> Verbosity
6567
-> Bool -- use_external_internal_deps
6668
-> ComponentRequestedSpec
6769
-> Bool -- deterministic
@@ -204,7 +206,8 @@ configureComponentLocalBuildInfos
204206
------------------------------------------------------------------------------
205207

206208
toComponentLocalBuildInfos
207-
:: Compiler
209+
:: HasCallStack
210+
=> Compiler
208211
-> InstalledPackageIndex -- FULL set
209212
-> [ConfiguredPromisedComponent]
210213
-> PackageDescription
@@ -230,12 +233,12 @@ toComponentLocalBuildInfos
230233
-- since we will pay for the ALL installed packages even if
231234
-- they are not related to what we are building. This was true
232235
-- in the old configure code.
233-
external_graph :: Graph (Either InstalledPackageInfo ReadyComponent)
236+
external_graph :: HasCallStack => Graph (Either InstalledPackageInfo ReadyComponent)
234237
external_graph =
235238
Graph.fromDistinctList
236239
. map Left
237240
$ PackageIndex.allPackages installedPackageSet
238-
internal_graph :: Graph (Either InstalledPackageInfo ReadyComponent)
241+
internal_graph :: HasCallStack => Graph (Either InstalledPackageInfo ReadyComponent)
239242
internal_graph =
240243
Graph.fromDistinctList
241244
. map Right

Cabal/src/Distribution/Simple/Configure.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ import Text.PrettyPrint
182182
import qualified Data.Maybe as M
183183
import qualified Data.Set as Set
184184
import qualified Distribution.Compat.NonEmptySet as NES
185+
import GHC.Stack (HasCallStack)
185186

186187
type UseExternalInternalDeps = Bool
187188

@@ -1207,7 +1208,8 @@ finalCheckPackage
12071208
enabled
12081209

12091210
configureComponents
1210-
:: LBC.LocalBuildConfig
1211+
:: HasCallStack
1212+
=> LBC.LocalBuildConfig
12111213
-> LBC.PackageBuildDescr
12121214
-> PackageInfo
12131215
-> ([PreExistingComponent], [ConfiguredPromisedComponent])

Cabal/src/Distribution/Types/LocalBuildInfo.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ import Distribution.Compat.Graph (Graph)
132132
import qualified Distribution.Compat.Graph as Graph
133133

134134
import qualified System.FilePath as FilePath (takeDirectory)
135+
import GHC.Stack (HasCallStack)
135136

136137
-- | Data cached after configuration step. See also
137138
-- 'Distribution.Simple.Setup.ConfigFlags'.
@@ -415,7 +416,7 @@ withAllTargetsInBuildOrder' pkg_descr lbi f =
415416
-- the order they need to be built.
416417
-- Has a prime because it takes a 'PackageDescription' argument
417418
-- which may disagree with 'localPkgDescr' in 'LocalBuildInfo'.
418-
neededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo]
419+
neededTargetsInBuildOrder' :: HasCallStack => PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo]
419420
neededTargetsInBuildOrder' pkg_descr lbi@(LocalBuildInfo{componentGraph = compsGraph}) uids =
420421
case Graph.closure compsGraph uids of
421422
Nothing -> error $ "localBuildPlan: missing uids " ++ intercalate ", " (map prettyShow uids)

cabal-install-solver/src/Distribution/Solver/Modular/Cycles.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Distribution.Solver.Modular.Tree
1515
import qualified Distribution.Solver.Modular.ConflictSet as CS
1616
import Distribution.Solver.Types.ComponentDeps (Component)
1717
import Distribution.Solver.Types.PackagePath
18+
import GHC.Stack (HasCallStack)
1819

1920
-- | Find and reject any nodes with cyclic dependencies
2021
detectCyclesPhase :: Tree d c -> Tree d c
@@ -51,7 +52,7 @@ detectCyclesPhase = go
5152
-- all decisions that could potentially break the cycle.
5253
--
5354
-- TODO: The conflict set should also contain flag and stanza variables.
54-
findCycles :: QPN -> RevDepMap -> Maybe ConflictSet
55+
findCycles :: HasCallStack => QPN -> RevDepMap -> Maybe ConflictSet
5556
findCycles pkg rdm =
5657
-- This function has two parts: a faster cycle check that is called at every
5758
-- step and a slower calculation of the conflict set.
@@ -115,6 +116,6 @@ instance G.IsNode RevDepMapNode where
115116
nodeKey (RevDepMapNode qpn _) = qpn
116117
nodeNeighbors (RevDepMapNode _ ns) = ordNub $ map snd ns
117118

118-
revDepMapToGraph :: RevDepMap -> G.Graph RevDepMapNode
119+
revDepMapToGraph :: HasCallStack => RevDepMap -> G.Graph RevDepMapNode
119120
revDepMapToGraph rdm = G.fromDistinctList
120121
[RevDepMapNode qpn ns | (qpn, ns) <- M.toList rdm]

cabal-install/src/Distribution/Client/Dependency.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ import qualified Data.Map as Map
167167
import qualified Data.Set as Set
168168
import Text.PrettyPrint hiding ((<>))
169169
import Data.Maybe (fromJust)
170+
import GHC.Stack (HasCallStack)
170171

171172
-- ------------------------------------------------------------
172173

@@ -835,7 +836,7 @@ resolveDependencies toolchains pkgConfigDB installedPkgIndex params = do
835836
preferences :: PackageName -> PackagePreferences
836837
preferences = interpretPackagesPreference targets defpref prefs
837838

838-
dumpResolverPackageIndex :: [ResolverPackage UnresolvedPkgLoc] -> Doc
839+
dumpResolverPackageIndex :: HasCallStack => [ResolverPackage UnresolvedPkgLoc] -> Doc
839840
dumpResolverPackageIndex pkgs =
840841
vcat
841842
[
@@ -1010,7 +1011,8 @@ interpretPackagesPreference selected defaultPref prefs =
10101011
-- | Make an install plan from the output of the dep resolver.
10111012
-- It checks that the plan is valid, or it's an error in the dep resolver.
10121013
validateSolverResult
1013-
:: Staged (CompilerInfo, Platform)
1014+
:: HasCallStack
1015+
=> Staged (CompilerInfo, Platform)
10141016
-> [ResolverPackage UnresolvedPkgLoc]
10151017
-> Progress String String SolverInstallPlan
10161018
validateSolverResult toolchains pkgs =

cabal-install/src/Distribution/Client/InstallPlan.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ fromSolverInstallPlan f plan =
588588
(\mapDep planpkg -> return $ f mapDep planpkg)
589589
plan
590590

591+
591592
fromSolverInstallPlanWithProgress
592593
:: HasCallStack
593594
=> ( IsNode ipkg, Key ipkg ~ key

cabal-install/src/Distribution/Client/ProjectPlanOutput.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import System.FilePath
7373
import System.IO
7474

7575
import Distribution.Simple.Program.GHC (packageDbArgsDb)
76+
import GHC.Stack (HasCallStack)
7677

7778
-----------------------------------------------------------------------------
7879
-- Writing plan.json files
@@ -524,7 +525,8 @@ data PostBuildProjectStatus = PostBuildProjectStatus
524525

525526
-- | Work out which packages are out of date or invalid after a build.
526527
postBuildProjectStatus
527-
:: ElaboratedInstallPlan
528+
:: HasCallStack
529+
=> ElaboratedInstallPlan
528530
-> PackagesUpToDate
529531
-> BuildStatusMap
530532
-> BuildOutcomes
@@ -621,7 +623,7 @@ postBuildProjectStatus
621623
)
622624

623625
-- The plan graph but only counting dependency-on-library edges
624-
packagesLibDepGraph :: Graph (Node UnitId ElaboratedPlanPackage)
626+
packagesLibDepGraph :: HasCallStack => Graph (Node UnitId ElaboratedPlanPackage)
625627
packagesLibDepGraph =
626628
Graph.fromDistinctList
627629
[ Graph.N pkg (installedUnitId pkg) libdeps

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ import Distribution.Client.Errors
236236
import Distribution.Solver.Types.ProjectConfigPath
237237
import System.FilePath
238238
import qualified Text.PrettyPrint as Disp
239+
import GHC.Stack (HasCallStack)
239240

240241
-- | Check that an 'ElaboratedConfiguredPackage' actually makes
241242
-- sense under some 'ElaboratedSharedConfig'.
@@ -1538,7 +1539,8 @@ planPackages
15381539
-- In theory should be able to make an elaborated install plan with a policy
15391540
-- matching that of the classic @cabal install --user@ or @--global@
15401541
elaborateInstallPlan
1541-
:: Verbosity
1542+
:: HasCallStack
1543+
=> Verbosity
15421544
-> Map FilePath HookAccept
15431545
-> Staged Toolchain
15441546
-> Staged (Maybe PkgConfigDb)
@@ -1616,12 +1618,14 @@ elaborateInstallPlan
16161618
-- NB: We don't INSTANTIATE packages at this point. That's
16171619
-- a post-pass. This makes it simpler to compute dependencies.
16181620
elaborateSolverToComponents
1619-
:: (SolverId -> [ElaboratedPlanPackage])
1621+
:: HasCallStack
1622+
=> (SolverId -> [ElaboratedPlanPackage])
16201623
-> SolverPackage UnresolvedPkgLoc
16211624
-> LogProgress [ElaboratedConfiguredPackage]
16221625
elaborateSolverToComponents mapDep spkg@(SolverPackage _ _ _ _ _ deps0 exe_deps0) =
16231626
case mkComponentsGraph (elabEnabledSpec elab0) pd of
16241627
Right g -> do
1628+
infoProgress $ text "here"
16251629
let src_comps = componentsGraphToList g
16261630
infoProgress $
16271631
hang
@@ -1759,7 +1763,8 @@ elaborateInstallPlan
17591763
++ " not implemented yet"
17601764

17611765
buildComponent
1762-
:: ( ConfiguredComponentMap
1766+
:: HasCallStack
1767+
=> ( ConfiguredComponentMap
17631768
, LinkedComponentMap
17641769
, Map ComponentId FilePath
17651770
)
@@ -1832,6 +1837,7 @@ elaborateInstallPlan
18321837
elab1 -- knot tied
18331838
)
18341839
cc = cc0{cc_ann_id = fmap (const cid) (cc_ann_id cc0)}
1840+
18351841
infoProgress $ dispConfiguredComponent cc
18361842

18371843
-- 4. Perform mix-in linking
@@ -1847,6 +1853,7 @@ elaborateInstallPlan
18471853
(elabPkgSourceId elab0)
18481854
(Map.union external_lc_map lc_map)
18491855
cc
1856+
18501857
infoProgress $ dispLinkedComponent lc
18511858
-- NB: elab is setup to be the correct form for an
18521859
-- indefinite library, or a definite library with no holes.
@@ -2673,7 +2680,8 @@ extractElabBuildStyle _ = BuildAndInstall
26732680
-- we don't instantiate the same thing multiple times.
26742681
--
26752682
instantiateInstallPlan
2676-
:: StoreDirLayout
2683+
:: HasCallStack
2684+
=> StoreDirLayout
26772685
-> Staged InstallDirs.InstallDirTemplates
26782686
-> ElaboratedSharedConfig
26792687
-> ElaboratedInstallPlan
@@ -3205,7 +3213,8 @@ data TargetAction
32053213
-- will prune differently depending on what is already installed (to
32063214
-- implement "sticky" test suite enabling behavior).
32073215
pruneInstallPlanToTargets
3208-
:: TargetAction
3216+
:: HasCallStack
3217+
=> TargetAction
32093218
-> Map UnitId [ComponentTarget]
32103219
-> ElaboratedInstallPlan
32113220
-> ElaboratedInstallPlan
@@ -3301,7 +3310,8 @@ setRootTargets targetAction perPkgTargetsMap =
33013310
-- are used only by unneeded optional stanzas. These pruned deps are only
33023311
-- used for the dependency closure and are not persisted in this pass.
33033312
pruneInstallPlanPass1
3304-
:: [ElaboratedPlanPackage]
3313+
:: HasCallStack
3314+
=> [ElaboratedPlanPackage]
33053315
-> [ElaboratedPlanPackage]
33063316
pruneInstallPlanPass1 pkgs
33073317
-- if there are repl targets, we need to do a bit more work
@@ -3661,7 +3671,8 @@ mapConfiguredPackage _ (InstallPlan.PreExisting pkg) =
36613671
--
36623672
-- This is not always possible.
36633673
pruneInstallPlanToDependencies
3664-
:: Set UnitId
3674+
:: HasCallStack
3675+
=> Set UnitId
36653676
-> ElaboratedInstallPlan
36663677
-> Either
36673678
CannotPruneDependencies

0 commit comments

Comments
 (0)