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/Unit/Module/Location.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/Unit/Module/Location.hs')
-rw-r--r-- | compiler/GHC/Unit/Module/Location.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/GHC/Unit/Module/Location.hs b/compiler/GHC/Unit/Module/Location.hs index 540f2305d2..7518bd63e8 100644 --- a/compiler/GHC/Unit/Module/Location.hs +++ b/compiler/GHC/Unit/Module/Location.hs @@ -9,6 +9,7 @@ module GHC.Unit.Module.Location where import GHC.Prelude +import GHC.Unit.Types import GHC.Utils.Outputable -- | Module Location @@ -54,10 +55,10 @@ addBootSuffix :: FilePath -> FilePath addBootSuffix path = path ++ "-boot" -- | Add the @-boot@ suffix if the @Bool@ argument is @True@ -addBootSuffix_maybe :: Bool -> FilePath -> FilePath -addBootSuffix_maybe is_boot path - | is_boot = addBootSuffix path - | otherwise = path +addBootSuffix_maybe :: IsBootInterface -> FilePath -> FilePath +addBootSuffix_maybe is_boot path = case is_boot of + IsBoot -> addBootSuffix path + NotBoot -> path -- | Add the @-boot@ suffix to all file paths associated with the module addBootSuffixLocn :: ModLocation -> ModLocation |