diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-05-19 12:19:55 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-13 02:13:03 -0400 |
commit | a444d01bc97be99b7743b752a33ca9982de4c0f1 (patch) | |
tree | 5d910c3aac0877421bf1aca5baec96c839813929 /compiler | |
parent | 42c054f6cd7a9890c3e9d2d0c444252abe08a8d5 (diff) | |
download | haskell-a444d01bc97be99b7743b752a33ca9982de4c0f1.tar.gz |
DynFlags: reportCycles, reportUnusable
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Unit/State.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/GHC/Unit/State.hs b/compiler/GHC/Unit/State.hs index 0fc3c3350e..2a68c36f12 100644 --- a/compiler/GHC/Unit/State.hs +++ b/compiler/GHC/Unit/State.hs @@ -1169,20 +1169,20 @@ pprReason pref reason = case reason of pref <+> text "unusable due to shadowed dependencies:" $$ nest 2 (hsep (map ppr deps)) -reportCycles :: DynFlags -> [SCC UnitInfo] -> IO () -reportCycles dflags sccs = mapM_ report sccs +reportCycles :: (SDoc -> IO ()) -> [SCC UnitInfo] -> IO () +reportCycles printer sccs = mapM_ report sccs where report (AcyclicSCC _) = return () report (CyclicSCC vs) = - debugTraceMsg dflags 2 $ + printer $ text "these packages are involved in a cycle:" $$ nest 2 (hsep (map (ppr . unitId) vs)) -reportUnusable :: DynFlags -> UnusableUnits -> IO () -reportUnusable dflags pkgs = mapM_ report (Map.toList pkgs) +reportUnusable :: (SDoc -> IO ()) -> UnusableUnits -> IO () +reportUnusable printer pkgs = mapM_ report (Map.toList pkgs) where report (ipid, (_, reason)) = - debugTraceMsg dflags 2 $ + printer $ pprReason (text "package" <+> ppr ipid <+> text "is") reason @@ -1437,8 +1437,8 @@ mkUnitState dflags dbs = do -- packages. let (pkg_map2, unusable, sccs) = validateDatabase dflags pkg_map1 - reportCycles dflags sccs - reportUnusable dflags unusable + reportCycles (debugTraceMsg dflags 2) sccs + reportUnusable (debugTraceMsg dflags 2) unusable -- Apply trust flags (these flags apply regardless of whether -- or not packages are visible or not) |