From 32a4ae90b50cc56f2955f489ad0cf8c7ff5e131a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 30 Apr 2020 11:07:15 -0400 Subject: 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. --- compiler/GHC/Unit/Module/Location.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'compiler/GHC/Unit/Module') 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 -- cgit v1.2.1