summaryrefslogtreecommitdiff
path: root/compiler/GHC/Unit/Module/Location.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Unit/Module/Location.hs')
-rw-r--r--compiler/GHC/Unit/Module/Location.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/GHC/Unit/Module/Location.hs b/compiler/GHC/Unit/Module/Location.hs
index 6f239227f0..ff5354bfdb 100644
--- a/compiler/GHC/Unit/Module/Location.hs
+++ b/compiler/GHC/Unit/Module/Location.hs
@@ -5,6 +5,7 @@ module GHC.Unit.Module.Location
, addBootSuffix_maybe
, addBootSuffixLocn
, addBootSuffixLocnOut
+ , removeBootSuffix
)
where
@@ -54,6 +55,13 @@ instance Outputable ModLocation where
addBootSuffix :: FilePath -> FilePath
addBootSuffix path = path ++ "-boot"
+-- | Remove the @-boot@ suffix to .hs, .hi and .o files
+removeBootSuffix :: FilePath -> FilePath
+removeBootSuffix "-boot" = []
+removeBootSuffix (x:xs) = x : removeBootSuffix xs
+removeBootSuffix [] = error "removeBootSuffix: no -boot suffix"
+
+
-- | Add the @-boot@ suffix if the @Bool@ argument is @True@
addBootSuffix_maybe :: IsBootInterface -> FilePath -> FilePath
addBootSuffix_maybe is_boot path = case is_boot of