diff options
author | John Ericson <git@JohnEricson.me> | 2019-05-21 23:00:27 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-05-29 16:06:45 -0400 |
commit | ace2e3350fa7da1f7ebcdb882f1241da10a90c26 (patch) | |
tree | a6ea9a688e3bf1230e8775e9f41a86576a9523b4 /compiler/utils/Platform.hs | |
parent | 2d2aa2031b9abc3bff7b5585ab4201948c8bba7d (diff) | |
download | haskell-ace2e3350fa7da1f7ebcdb882f1241da10a90c26.tar.gz |
Break up `Settings` into smaller structs
As far as I can tell, the fields within `Settings` aren't *intrinsicly*
related. They just happen to be initialized the same way (in particular
prior to the rest of `DynFlags`), and that is why they are grouped
together.
Within `Settings`, however, there are groups of settings that clearly do
share something in common, regardless of how they anything is
initialized.
In the spirit of GHC being a library, where the end cosumer may choose
to initialize this configuration in arbitrary ways, I made some new data
types for thoses groups internal to `Settings`, and used them to define
`Settings` instead. Hopefully this is a baby step towards a general
decoupling of the stateful and stateless parts of GHC.
Diffstat (limited to 'compiler/utils/Platform.hs')
-rw-r--r-- | compiler/utils/Platform.hs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs index 449a62a5b6..5f7d939f0d 100644 --- a/compiler/utils/Platform.hs +++ b/compiler/utils/Platform.hs @@ -16,6 +16,9 @@ module Platform ( osMachOTarget, osSubsectionsViaSymbols, platformUsesFrameworks, + + PlatformMisc(..), + IntegerLibrary(..), ) where @@ -160,3 +163,28 @@ osSubsectionsViaSymbols :: OS -> Bool osSubsectionsViaSymbols OSDarwin = True osSubsectionsViaSymbols _ = False +-- | Platform-specific settings formerly hard-coded in Config.hs. +-- +-- These should probably be all be triaged whether they can be computed from +-- other settings or belong in another another place (like 'Platform' above). +data PlatformMisc = PlatformMisc + { -- TODO Recalculate string from richer info? + platformMisc_targetPlatformString :: String + , platformMisc_integerLibrary :: String + , platformMisc_integerLibraryType :: IntegerLibrary + , platformMisc_ghcWithInterpreter :: Bool + , platformMisc_ghcWithNativeCodeGen :: Bool + , platformMisc_ghcWithSMP :: Bool + , platformMisc_ghcRTSWays :: String + , platformMisc_tablesNextToCode :: Bool + , platformMisc_leadingUnderscore :: Bool + , platformMisc_libFFI :: Bool + , platformMisc_ghcThreaded :: Bool + , platformMisc_ghcDebugged :: Bool + , platformMisc_ghcRtsWithLibdw :: Bool + } + +data IntegerLibrary + = IntegerGMP + | IntegerSimple + deriving (Read, Show, Eq) |