diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-04-30 11:07:15 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-04 04:34:42 -0400 |
commit | 32a4ae90b50cc56f2955f489ad0cf8c7ff5e131a (patch) | |
tree | 274e86d49420a09eb8400bc3751c55f827ed4e56 /compiler/GHC/Iface/Recomp.hs | |
parent | cb5c31b51b021ce86890bba73276fe6f7405f5d3 (diff) | |
download | haskell-32a4ae90b50cc56f2955f489ad0cf8c7ff5e131a.tar.gz |
Clean up boot vs non-boot disambiguating types
We often have (ModuleName, Bool) or (Module, Bool) pairs for "extended"
module names (without or with a unit id) disambiguating boot and normal
modules. We think this is important enough across the compiler that it
deserves a new nominal product type. We do this with synnoyms and a
functor named with a `Gen` prefix, matching other newly created
definitions.
It was also requested that we keep custom `IsBoot` / `NotBoot` sum type.
So we have it too. This means changing many the many bools to use that
instead.
Updates `haddock` submodule.
Diffstat (limited to 'compiler/GHC/Iface/Recomp.hs')
-rw-r--r-- | compiler/GHC/Iface/Recomp.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs index 68103fc1f4..03223c5712 100644 --- a/compiler/GHC/Iface/Recomp.hs +++ b/compiler/GHC/Iface/Recomp.hs @@ -252,7 +252,7 @@ checkVersions hsc_env mod_summary iface where this_pkg = thisPackage (hsc_dflags hsc_env) -- This is a bit of a hack really - mod_deps :: ModuleNameEnv (ModuleName, IsBootInterface) + mod_deps :: ModuleNameEnv ModuleNameWithIsBoot mod_deps = mkModDeps (dep_mods (mi_deps iface)) -- | Check if any plugins are requesting recompilation @@ -455,7 +455,7 @@ checkDependencies hsc_env summary iface case find_res of Found _ mod | pkg == this_pkg - -> if moduleName mod `notElem` map fst prev_dep_mods ++ prev_dep_plgn + -> if moduleName mod `notElem` map gwib_mod prev_dep_mods ++ prev_dep_plgn then do traceHiDiffs $ text "imported module " <> quotes (ppr mod) <> text " not among previous dependencies" @@ -474,7 +474,9 @@ checkDependencies hsc_env summary iface where pkg = moduleUnit mod _otherwise -> return (RecompBecause reason) - old_deps = Set.fromList $ map fst $ filter (not . snd) prev_dep_mods + projectNonBootNames = map gwib_mod . filter ((== NotBoot) . gwib_isBoot) + old_deps = Set.fromList + $ projectNonBootNames prev_dep_mods isOldHomeDeps = flip Set.member old_deps checkForNewHomeDependency (L _ mname) = do let @@ -489,7 +491,7 @@ checkDependencies hsc_env summary iface then return (UpToDate, []) else do mb_result <- getFromModIface "need mi_deps for" mod $ \imported_iface -> do - let mnames = mname:(map fst $ filter (not . snd) $ + let mnames = mname:(map gwib_mod $ filter ((== NotBoot) . gwib_isBoot) $ dep_mods $ mi_deps imported_iface) case find (not . isOldHomeDeps) mnames of Nothing -> return (UpToDate, mnames) @@ -1073,7 +1075,7 @@ getOrphanHashes hsc_env mods = do sortDependencies :: Dependencies -> Dependencies sortDependencies d - = Deps { dep_mods = sortBy (compare `on` (moduleNameFS.fst)) (dep_mods d), + = Deps { dep_mods = sortBy (compare `on` (moduleNameFS . gwib_mod)) (dep_mods d), dep_pkgs = sortBy (compare `on` fst) (dep_pkgs d), dep_orphs = sortBy stableModuleCmp (dep_orphs d), dep_finsts = sortBy stableModuleCmp (dep_finsts d), |