summaryrefslogtreecommitdiff
path: root/compiler/main/GHC.hs
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2017-06-14 08:51:43 -0700
committerBartosz Nitka <niteria@gmail.com>2017-06-14 08:52:02 -0700
commit430137c45420153dafbd448b4d509f893fe675f4 (patch)
treeb9617ce14ab664ef1991f73b0044646b0770cb0c /compiler/main/GHC.hs
parentece39c34b7846647441251fe72654f70cdf4a9a4 (diff)
downloadhaskell-430137c45420153dafbd448b4d509f893fe675f4.tar.gz
Add mapMG to allow making ModuleGraph abstract
Currently GHC exposes the internal details of `ModuleGraph` which inhibits making `ModuleGraph` support faster lookups. Haddock relies on the internal representation by using `map` on `ModuleGraph`. See also https://github.com/haskell/haddock/issues/635 Adding `mapMG` should allow us to make `ModuleGraph` abstract. Test Plan: ./validate Reviewers: simonmar, austin, bgamari, alexbiehl Reviewed By: bgamari, alexbiehl Subscribers: alexbiehl, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3645
Diffstat (limited to 'compiler/main/GHC.hs')
-rw-r--r--compiler/main/GHC.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index d58f3e9299..2102009019 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -59,7 +59,8 @@ module GHC (
compileToCoreModule, compileToCoreSimplified,
-- * Inspecting the module structure of the program
- ModuleGraph, ModSummary(..), ms_mod_name, ModLocation(..),
+ ModuleGraph, emptyMG, mapMG,
+ ModSummary(..), ms_mod_name, ModLocation(..),
getModSummary,
getModuleGraph,
isLoaded,
@@ -630,7 +631,7 @@ setProgramDynFlags_ invalidate_needed dflags = do
--
invalidateModSummaryCache :: GhcMonad m => m ()
invalidateModSummaryCache =
- modifySession $ \h -> h { hsc_mod_graph = map inval (hsc_mod_graph h) }
+ modifySession $ \h -> h { hsc_mod_graph = mapMG inval (hsc_mod_graph h) }
where
inval ms = ms { ms_hs_date = addUTCTime (-1) (ms_hs_date ms) }