diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-08-05 15:01:19 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-08-06 13:34:08 -0400 |
commit | 63348155404c64334fa864454132630f9d2a4d7f (patch) | |
tree | 94bf180a328863dbd150d87a712d43c2cfa6bbda /compiler/GHC/Platform | |
parent | d2a432258fa00e22ca386ef30d0a77ff5b277db8 (diff) | |
download | haskell-63348155404c64334fa864454132630f9d2a4d7f.tar.gz |
Use a type alias for Ways
Diffstat (limited to 'compiler/GHC/Platform')
-rw-r--r-- | compiler/GHC/Platform/Profile.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Platform/Ways.hs | 13 |
2 files changed, 10 insertions, 9 deletions
diff --git a/compiler/GHC/Platform/Profile.hs b/compiler/GHC/Platform/Profile.hs index 5875e5d56d..b9011d35b5 100644 --- a/compiler/GHC/Platform/Profile.hs +++ b/compiler/GHC/Platform/Profile.hs @@ -13,8 +13,6 @@ import GHC.Prelude import GHC.Platform import GHC.Platform.Ways -import Data.Set - -- | A platform profile fully describes the kind of objects that are generated -- for a platform. -- @@ -22,8 +20,8 @@ import Data.Set -- (profiling, debug, dynamic) also modify the ABI. -- data Profile = Profile - { profilePlatform :: !Platform -- ^ Platform - , profileWays :: !(Set Way) -- ^ Ways + { profilePlatform :: !Platform -- ^ Platform + , profileWays :: !Ways -- ^ Ways } -- | Get platform constants diff --git a/compiler/GHC/Platform/Ways.hs b/compiler/GHC/Platform/Ways.hs index c672ab656d..c4ba0e18de 100644 --- a/compiler/GHC/Platform/Ways.hs +++ b/compiler/GHC/Platform/Ways.hs @@ -20,6 +20,7 @@ -- this compilation. module GHC.Platform.Ways ( Way(..) + , Ways , hasWay , allowed_combination , wayGeneralFlags @@ -61,12 +62,14 @@ data Way | WayDyn -- ^ Dynamic linking deriving (Eq, Ord, Show) +type Ways = Set Way + -- | Test if a ways is enabled -hasWay :: Set Way -> Way -> Bool +hasWay :: Ways -> Way -> Bool hasWay ws w = Set.member w ws -- | Check if a combination of ways is allowed -allowed_combination :: Set Way -> Bool +allowed_combination :: Ways -> Bool allowed_combination ways = not disallowed where disallowed = or [ hasWay ways x && hasWay ways y @@ -76,13 +79,13 @@ allowed_combination ways = not disallowed couples = [] -- we don't have any disallowed combination of ways nowadays -- | Unique tag associated to a list of ways -waysTag :: Set Way -> String +waysTag :: Ways -> String waysTag = concat . intersperse "_" . map wayTag . Set.toAscList -- | Unique build-tag associated to a list of ways -- -- RTS only ways are filtered out because they have no impact on the build. -waysBuildTag :: Set Way -> String +waysBuildTag :: Ways -> String waysBuildTag ws = waysTag (Set.filter (not . wayRTSOnly) ws) @@ -195,7 +198,7 @@ foreign import ccall unsafe "rts_isDynamic" rtsIsDynamicIO :: IO Int -- | Return host "full" ways (i.e. ways that have an impact on the compilation, -- not RTS only ways). These ways must be used when compiling codes targeting -- the internal interpreter. -hostFullWays :: Set Way +hostFullWays :: Ways hostFullWays = Set.unions [ if hostIsDynamic then Set.singleton WayDyn else Set.empty , if hostIsProfiled then Set.singleton WayProf else Set.empty |