{-# LANGUAGE LambdaCase #-}
module GHC.Driver.DynFlags (
DumpFlag(..),
GeneralFlag(..),
WarningFlag(..), DiagnosticReason(..),
Language(..),
FatalMessager, FlushOut(..),
ProfAuto(..),
hasPprDebug, hasNoDebugOutput, hasNoStateHack, hasNoOptCoercion,
dopt, dopt_set, dopt_unset,
gopt, gopt_set, gopt_unset,
wopt, wopt_set, wopt_unset,
wopt_fatal, wopt_set_fatal, wopt_unset_fatal,
wopt_set_all_custom, wopt_unset_all_custom,
wopt_set_all_fatal_custom, wopt_unset_all_fatal_custom,
wopt_set_custom, wopt_unset_custom,
wopt_set_fatal_custom, wopt_unset_fatal_custom,
wopt_any_custom,
xopt, xopt_set, xopt_unset,
xopt_set_unlessExplSpec,
xopt_DuplicateRecordFields,
xopt_FieldSelectors,
lang_set,
DynamicTooState(..), dynamicTooState, setDynamicNow,
OnOff(..),
DynFlags(..),
ParMakeCount(..),
ways,
HasDynFlags(..), ContainsDynFlags(..),
RtsOptsEnabled(..),
GhcMode(..), isOneShot,
GhcLink(..), isNoLink,
PackageFlag(..), PackageArg(..), ModRenaming(..),
packageFlagsChanged,
IgnorePackageFlag(..), TrustFlag(..),
PackageDBFlag(..), PkgDbRef(..),
Option(..), showOpt,
DynLibLoader(..),
positionIndependent,
optimisationFlags,
targetProfile,
ReexportedModule(..),
defaultDynFlags,
initDynFlags,
defaultFatalMessager,
defaultFlushOut,
optLevelFlags,
languageExtensions,
TurnOnFlag,
turnOn,
turnOff,
programName, projectVersion,
ghcUsagePath, ghciUsagePath, topDir, toolDir,
versionedAppDir, versionedFilePath,
extraGccViaCFlags, globalPackageDatabasePath,
IncludeSpecs(..), addGlobalInclude, addQuoteInclude, flattenIncludes,
addImplicitQuoteInclude,
initSDocContext, initDefaultSDocContext,
initPromotionTickContext,
isSse4_1Enabled,
isSse4_2Enabled,
isAvxEnabled,
isAvx2Enabled,
isAvx512cdEnabled,
isAvx512erEnabled,
isAvx512fEnabled,
isAvx512pfEnabled,
isFmaEnabled,
isBmiEnabled,
isBmi2Enabled
) where
import GHC.Prelude
import GHC.Platform
import GHC.Platform.Ways
import GHC.Platform.Profile
import GHC.CmmToAsm.CFG.Weight
import GHC.Core.Unfold
import GHC.Data.Bool
import GHC.Data.EnumSet (EnumSet)
import GHC.Data.Maybe
import GHC.Builtin.Names ( mAIN_NAME )
import GHC.Driver.Backend
import GHC.Driver.Flags
import GHC.Driver.Phases ( Phase(..), phaseInputExt )
import GHC.Driver.Plugins.External
import GHC.Settings
import GHC.Settings.Constants
import GHC.Types.Basic ( IntWithInf, treatZeroAsInf )
import GHC.Types.Error (DiagnosticReason(..))
import GHC.Types.ProfAuto
import GHC.Types.SafeHaskell
import GHC.Types.SrcLoc
import GHC.Unit.Module
import GHC.Unit.Module.Warnings
import GHC.Utils.CliOption
import GHC.SysTools.Terminal ( stderrSupportsAnsiColors )
import GHC.UniqueSubdir (uniqueSubdir)
import GHC.Utils.Outputable
import GHC.Utils.Panic
import GHC.Utils.TmpFs
import qualified GHC.Types.FieldLabel as FieldLabel
import qualified GHC.Utils.Ppr.Colour as Col
import qualified GHC.Data.EnumSet as EnumSet
import GHC.Core.Opt.CallerCC.Types
import Control.Monad (msum, (<=<))
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Except (ExceptT)
import Control.Monad.Trans.Reader (ReaderT)
import Control.Monad.Trans.Writer (WriterT)
import Data.Word
import System.IO
import System.IO.Error (catchIOError)
import System.Environment (lookupEnv)
import System.FilePath (normalise, (</>))
import System.Directory
import GHC.Foreign (withCString, peekCString)
import qualified Data.Set as Set
import qualified GHC.LanguageExtensions as LangExt
data DynFlags = DynFlags {
DynFlags -> GhcMode
ghcMode :: GhcMode,
DynFlags -> GhcLink
ghcLink :: GhcLink,
DynFlags -> Backend
backend :: !Backend,
DynFlags -> GhcNameVersion
ghcNameVersion :: {-# UNPACK #-} !GhcNameVersion,
DynFlags -> FileSettings
fileSettings :: {-# UNPACK #-} !FileSettings,
DynFlags -> Platform
targetPlatform :: Platform,
DynFlags -> ToolSettings
toolSettings :: {-# UNPACK #-} !ToolSettings,
DynFlags -> PlatformMisc
platformMisc :: {-# UNPACK #-} !PlatformMisc,
DynFlags -> [(String, String)]
rawSettings :: [(String, String)],
DynFlags -> TempDir
tmpDir :: TempDir,
DynFlags -> Int
llvmOptLevel :: Int,
DynFlags -> Int
verbosity :: Int,
DynFlags -> Int
debugLevel :: Int,
DynFlags -> Int
simplPhases :: Int,
DynFlags -> Int
maxSimplIterations :: Int,
DynFlags -> Maybe String
ruleCheck :: Maybe String,
DynFlags -> [Int]
strictnessBefore :: [Int],
DynFlags -> Maybe ParMakeCount
parMakeCount :: Maybe ParMakeCount,
DynFlags -> Bool
enableTimeStats :: Bool,
DynFlags -> Maybe Int
ghcHeapSize :: Maybe Int,
DynFlags -> Maybe Int
maxRelevantBinds :: Maybe Int,
DynFlags -> Maybe Int
maxValidHoleFits :: Maybe Int,
DynFlags -> Maybe Int
maxRefHoleFits :: Maybe Int,
DynFlags -> Maybe Int
refLevelHoleFits :: Maybe Int,
DynFlags -> Int
maxUncoveredPatterns :: Int,
DynFlags -> Int
maxPmCheckModels :: Int,
DynFlags -> Int
simplTickFactor :: Int,
DynFlags -> Int
dmdUnboxWidth :: !Int,
DynFlags -> Int
ifCompression :: Int,
DynFlags -> Maybe Int
specConstrThreshold :: Maybe Int,
DynFlags -> Maybe Int
specConstrCount :: Maybe Int,
DynFlags -> Int
specConstrRecursive :: Int,
DynFlags -> Maybe Word
binBlobThreshold :: Maybe Word,
DynFlags -> Maybe Int
liberateCaseThreshold :: Maybe Int,
DynFlags -> Maybe Int
floatLamArgs :: Maybe Int,
DynFlags -> Maybe Int
liftLamsRecArgs :: Maybe Int,
DynFlags -> Maybe Int
liftLamsNonRecArgs :: Maybe Int,
DynFlags -> Bool
liftLamsKnown :: Bool,
DynFlags -> Maybe Int
cmmProcAlignment :: Maybe Int,
DynFlags -> Int
historySize :: Int,
DynFlags -> [String]
importPaths :: [FilePath],
DynFlags -> ModuleName
mainModuleNameIs :: ModuleName,
DynFlags -> Maybe String
mainFunIs :: Maybe String,
DynFlags -> IntWithInf
reductionDepth :: IntWithInf,
DynFlags -> IntWithInf
solverIterations :: IntWithInf,
DynFlags -> Int
givensFuel :: Int,
DynFlags -> Int
wantedsFuel :: Int,
DynFlags -> Int
qcsFuel :: Int,
DynFlags -> UnitId
homeUnitId_ :: UnitId,
DynFlags -> Maybe UnitId
homeUnitInstanceOf_ :: Maybe UnitId,
DynFlags -> [(ModuleName, Module)]
homeUnitInstantiations_ :: [(ModuleName, Module)],
DynFlags -> Maybe String
workingDirectory :: Maybe FilePath,
DynFlags -> Maybe String
thisPackageName :: Maybe String,
DynFlags -> Set ModuleName
hiddenModules :: Set.Set ModuleName,
DynFlags -> [ReexportedModule]
reexportedModules :: [ReexportedModule],
DynFlags -> Ways
targetWays_ :: Ways,
DynFlags -> Maybe (String, Int)
splitInfo :: Maybe (String,Int),
DynFlags -> Maybe String
objectDir :: Maybe String,
DynFlags -> Maybe String
dylibInstallName :: Maybe String,
DynFlags -> Maybe String
hiDir :: Maybe String,
DynFlags -> Maybe String
hieDir :: Maybe String,
DynFlags -> Maybe String
stubDir :: Maybe String,
DynFlags -> Maybe String
dumpDir :: Maybe String,
DynFlags -> String
objectSuf_ :: String,
DynFlags -> String
hcSuf :: String,
DynFlags -> String
hiSuf_ :: String,
DynFlags -> String
hieSuf :: String,
DynFlags -> String
dynObjectSuf_ :: String,
DynFlags -> String
dynHiSuf_ :: String,
DynFlags -> Maybe String
outputFile_ :: Maybe String,
DynFlags -> Maybe String
dynOutputFile_ :: Maybe String,
DynFlags -> Maybe String
outputHi :: Maybe String,
DynFlags -> Maybe String
dynOutputHi :: Maybe String,
DynFlags -> DynLibLoader
dynLibLoader :: DynLibLoader,
DynFlags -> Bool
dynamicNow :: !Bool,
DynFlags -> String
dumpPrefix :: FilePath,
DynFlags -> Maybe String
dumpPrefixForce :: Maybe FilePath,
DynFlags -> [Option]
ldInputs :: [Option],
DynFlags -> IncludeSpecs
includePaths :: IncludeSpecs,
DynFlags -> [String]
libraryPaths :: [String],
DynFlags -> [String]
frameworkPaths :: [String],
DynFlags -> [String]
cmdlineFrameworks :: [String],
DynFlags -> Maybe String
rtsOpts :: Maybe String,
DynFlags -> RtsOptsEnabled
rtsOptsEnabled :: RtsOptsEnabled,
DynFlags -> Bool
rtsOptsSuggestions :: Bool,
DynFlags -> String
hpcDir :: String,
DynFlags -> [ModuleName]
pluginModNames :: [ModuleName],
DynFlags -> [(ModuleName, String)]
pluginModNameOpts :: [(ModuleName,String)],
DynFlags -> [String]
frontendPluginOpts :: [String],
DynFlags -> [ExternalPluginSpec]
externalPluginSpecs :: [ExternalPluginSpec],
DynFlags -> String
depMakefile :: FilePath,
DynFlags -> Bool
depIncludePkgDeps :: Bool,
DynFlags -> Bool
depIncludeCppDeps :: Bool,
DynFlags -> [ModuleName]
depExcludeMods :: [ModuleName],
DynFlags -> [String]
depSuffixes :: [String],
DynFlags -> [PackageDBFlag]
packageDBFlags :: [PackageDBFlag],
DynFlags -> [IgnorePackageFlag]
ignorePackageFlags :: [IgnorePackageFlag],
DynFlags -> [PackageFlag]
packageFlags :: [PackageFlag],
DynFlags -> [PackageFlag]
pluginPackageFlags :: [PackageFlag],
DynFlags -> [TrustFlag]
trustFlags :: [TrustFlag],
DynFlags -> Maybe String
packageEnv :: Maybe FilePath,
DynFlags -> EnumSet DumpFlag
dumpFlags :: EnumSet DumpFlag,
DynFlags -> EnumSet GeneralFlag
generalFlags :: EnumSet GeneralFlag,
DynFlags -> EnumSet WarningFlag
warningFlags :: EnumSet WarningFlag,
DynFlags -> EnumSet WarningFlag
fatalWarningFlags :: EnumSet WarningFlag,
DynFlags -> WarningCategorySet
customWarningCategories :: WarningCategorySet,
DynFlags -> WarningCategorySet
fatalCustomWarningCategories :: WarningCategorySet,
DynFlags -> Maybe Language
language :: Maybe Language,
DynFlags -> SafeHaskellMode
safeHaskell :: SafeHaskellMode,
DynFlags -> Bool
safeInfer :: Bool,
DynFlags -> Bool
safeInferred :: Bool,
DynFlags -> SrcSpan
thOnLoc :: SrcSpan,
DynFlags -> SrcSpan
newDerivOnLoc :: SrcSpan,
DynFlags -> SrcSpan
deriveViaOnLoc :: SrcSpan,
DynFlags -> SrcSpan
overlapInstLoc :: SrcSpan,
DynFlags -> SrcSpan
incoherentOnLoc :: SrcSpan,
DynFlags -> SrcSpan
pkgTrustOnLoc :: SrcSpan,
DynFlags -> SrcSpan
warnSafeOnLoc :: SrcSpan,
DynFlags -> SrcSpan
warnUnsafeOnLoc :: SrcSpan,
DynFlags -> SrcSpan
trustworthyOnLoc :: SrcSpan,
DynFlags -> [OnOff Extension]
extensions :: [OnOff LangExt.Extension],
DynFlags -> EnumSet Extension
extensionFlags :: EnumSet LangExt.Extension,
DynFlags -> UnfoldingOpts
unfoldingOpts :: !UnfoldingOpts,
DynFlags -> Int
maxWorkerArgs :: Int,
DynFlags -> Int
maxForcedSpecArgs :: Int,
DynFlags -> Int
ghciHistSize :: Int,
DynFlags -> FlushOut
flushOut :: FlushOut,
DynFlags -> Maybe String
ghcVersionFile :: Maybe FilePath,
DynFlags -> Maybe String
haddockOptions :: Maybe String,
DynFlags -> [String]
ghciScripts :: [String],
DynFlags -> Int
pprUserLength :: Int,
DynFlags -> Int
pprCols :: Int,
DynFlags -> Bool
useUnicode :: Bool,
DynFlags -> OverridingBool
useColor :: OverridingBool,
DynFlags -> Bool
canUseColor :: Bool,
DynFlags -> OverridingBool
useErrorLinks :: OverridingBool,
DynFlags -> Bool
canUseErrorLinks :: Bool,
DynFlags -> Scheme
colScheme :: Col.Scheme,
DynFlags -> ProfAuto
profAuto :: ProfAuto,
DynFlags -> [CallerCcFilter]
callerCcFilters :: [CallerCcFilter],
DynFlags -> Maybe String
interactivePrint :: Maybe String,
DynFlags -> Maybe SseVersion
sseVersion :: Maybe SseVersion,
DynFlags -> Maybe BmiVersion
bmiVersion :: Maybe BmiVersion,
DynFlags -> Bool
avx :: Bool,
DynFlags -> Bool
avx2 :: Bool,
DynFlags -> Bool
avx512cd :: Bool,
DynFlags -> Bool
avx512er :: Bool,
DynFlags -> Bool
avx512f :: Bool,
DynFlags -> Bool
avx512pf :: Bool,
DynFlags -> Bool
fma :: Bool,
DynFlags -> Int
maxInlineAllocSize :: Int,
DynFlags -> Int
maxInlineMemcpyInsns :: Int,
DynFlags -> Int
maxInlineMemsetInsns :: Int,
DynFlags -> Bool
reverseErrors :: Bool,
DynFlags -> Maybe Int
maxErrors :: Maybe Int,
DynFlags -> Word64
initialUnique :: Word64,
DynFlags -> Int
uniqueIncrement :: Int,
DynFlags -> Weights
cfgWeights :: Weights
}
class HasDynFlags m where
getDynFlags :: m DynFlags
instance (Monoid a, Monad m, HasDynFlags m) => HasDynFlags (WriterT a m) where
getDynFlags :: WriterT a m DynFlags
getDynFlags = m DynFlags -> WriterT a m DynFlags
forall (m :: * -> *) a. Monad m => m a -> WriterT a m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m DynFlags
forall (m :: * -> *). HasDynFlags m => m DynFlags
getDynFlags
instance (Monad m, HasDynFlags m) => HasDynFlags (ReaderT a m) where
getDynFlags :: ReaderT a m DynFlags
getDynFlags = m DynFlags -> ReaderT a m DynFlags
forall (m :: * -> *) a. Monad m => m a -> ReaderT a m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m DynFlags
forall (m :: * -> *). HasDynFlags m => m DynFlags
getDynFlags
instance (Monad m, HasDynFlags m) => HasDynFlags (MaybeT m) where
getDynFlags :: MaybeT m DynFlags
getDynFlags = m DynFlags -> MaybeT m DynFlags
forall (m :: * -> *) a. Monad m => m a -> MaybeT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m DynFlags
forall (m :: * -> *). HasDynFlags m => m DynFlags
getDynFlags
instance (Monad m, HasDynFlags m) => HasDynFlags (ExceptT e m) where
getDynFlags :: ExceptT e m DynFlags
getDynFlags = m DynFlags -> ExceptT e m DynFlags
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m DynFlags
forall (m :: * -> *). HasDynFlags m => m DynFlags
getDynFlags
class ContainsDynFlags t where
:: t -> DynFlags
initDynFlags :: DynFlags -> IO DynFlags
initDynFlags :: DynFlags -> IO DynFlags
initDynFlags DynFlags
dflags = do
let
canUseUnicode <- do let enc :: TextEncoding
enc = TextEncoding
localeEncoding
str :: String
str = String
"‘’"
(TextEncoding -> String -> (CString -> IO Bool) -> IO Bool
forall a. TextEncoding -> String -> (CString -> IO a) -> IO a
withCString TextEncoding
enc String
str ((CString -> IO Bool) -> IO Bool)
-> (CString -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \CString
cstr ->
do str' <- TextEncoding -> CString -> IO String
peekCString TextEncoding
enc CString
cstr
return (str == str'))
IO Bool -> (IOError -> IO Bool) -> IO Bool
forall a. IO a -> (IOError -> IO a) -> IO a
`catchIOError` \IOError
_ -> Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
ghcNoUnicodeEnv <- lookupEnv "GHC_NO_UNICODE"
let useUnicode' = Maybe String -> Bool
forall a. Maybe a -> Bool
isNothing Maybe String
ghcNoUnicodeEnv Bool -> Bool -> Bool
&& Bool
canUseUnicode
maybeGhcColorsEnv <- lookupEnv "GHC_COLORS"
maybeGhcColoursEnv <- lookupEnv "GHC_COLOURS"
let adjustCols (Just String
env) = String -> (OverridingBool, Scheme) -> (OverridingBool, Scheme)
Col.parseScheme String
env
adjustCols Maybe String
Nothing = (OverridingBool, Scheme) -> (OverridingBool, Scheme)
forall a. a -> a
id
let (useColor', colScheme') =
(adjustCols maybeGhcColoursEnv . adjustCols maybeGhcColorsEnv)
(useColor dflags, colScheme dflags)
tmp_dir <- normalise <$> getTemporaryDirectory
return dflags{
useUnicode = useUnicode',
useColor = useColor',
canUseColor = stderrSupportsAnsiColors,
canUseErrorLinks = stderrSupportsAnsiColors,
colScheme = colScheme',
tmpDir = TempDir tmp_dir
}
defaultDynFlags :: Settings -> DynFlags
defaultDynFlags :: Settings -> DynFlags
defaultDynFlags Settings
mySettings =
DynFlags {
ghcMode :: GhcMode
ghcMode = GhcMode
CompManager,
ghcLink :: GhcLink
ghcLink = GhcLink
LinkBinary,
backend :: Backend
backend = Platform -> Backend
platformDefaultBackend (Settings -> Platform
sTargetPlatform Settings
mySettings),
verbosity :: Int
verbosity = Int
0,
debugLevel :: Int
debugLevel = Int
0,
simplPhases :: Int
simplPhases = Int
2,
maxSimplIterations :: Int
maxSimplIterations = Int
4,
ruleCheck :: Maybe String
ruleCheck = Maybe String
forall a. Maybe a
Nothing,
binBlobThreshold :: Maybe Word
binBlobThreshold = Word -> Maybe Word
forall a. a -> Maybe a
Just Word
500000,
maxRelevantBinds :: Maybe Int
maxRelevantBinds = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
6,
maxValidHoleFits :: Maybe Int
maxValidHoleFits = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
6,
maxRefHoleFits :: Maybe Int
maxRefHoleFits = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
6,
refLevelHoleFits :: Maybe Int
refLevelHoleFits = Maybe Int
forall a. Maybe a
Nothing,
maxUncoveredPatterns :: Int
maxUncoveredPatterns = Int
4,
maxPmCheckModels :: Int
maxPmCheckModels = Int
30,
simplTickFactor :: Int
simplTickFactor = Int
100,
dmdUnboxWidth :: Int
dmdUnboxWidth = Int
3,
ifCompression :: Int
ifCompression = Int
2,
specConstrThreshold :: Maybe Int
specConstrThreshold = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
2000,
specConstrCount :: Maybe Int
specConstrCount = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
3,
specConstrRecursive :: Int
specConstrRecursive = Int
3,
liberateCaseThreshold :: Maybe Int
liberateCaseThreshold = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
2000,
floatLamArgs :: Maybe Int
floatLamArgs = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
0,
liftLamsRecArgs :: Maybe Int
liftLamsRecArgs = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
5,
liftLamsNonRecArgs :: Maybe Int
liftLamsNonRecArgs = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
5,
liftLamsKnown :: Bool
liftLamsKnown = Bool
False,
cmmProcAlignment :: Maybe Int
cmmProcAlignment = Maybe Int
forall a. Maybe a
Nothing,
historySize :: Int
historySize = Int
20,
strictnessBefore :: [Int]
strictnessBefore = [],
parMakeCount :: Maybe ParMakeCount
parMakeCount = Maybe ParMakeCount
forall a. Maybe a
Nothing,
enableTimeStats :: Bool
enableTimeStats = Bool
False,
ghcHeapSize :: Maybe Int
ghcHeapSize = Maybe Int
forall a. Maybe a
Nothing,
importPaths :: [String]
importPaths = [String
"."],
mainModuleNameIs :: ModuleName
mainModuleNameIs = ModuleName
mAIN_NAME,
mainFunIs :: Maybe String
mainFunIs = Maybe String
forall a. Maybe a
Nothing,
reductionDepth :: IntWithInf
reductionDepth = Int -> IntWithInf
treatZeroAsInf Int
mAX_REDUCTION_DEPTH,
solverIterations :: IntWithInf
solverIterations = Int -> IntWithInf
treatZeroAsInf Int
mAX_SOLVER_ITERATIONS,
givensFuel :: Int
givensFuel = Int
mAX_GIVENS_FUEL,
wantedsFuel :: Int
wantedsFuel = Int
mAX_WANTEDS_FUEL,
qcsFuel :: Int
qcsFuel = Int
mAX_QC_FUEL,
homeUnitId_ :: UnitId
homeUnitId_ = UnitId
mainUnitId,
homeUnitInstanceOf_ :: Maybe UnitId
homeUnitInstanceOf_ = Maybe UnitId
forall a. Maybe a
Nothing,
homeUnitInstantiations_ :: [(ModuleName, Module)]
homeUnitInstantiations_ = [],
workingDirectory :: Maybe String
workingDirectory = Maybe String
forall a. Maybe a
Nothing,
thisPackageName :: Maybe String
thisPackageName = Maybe String
forall a. Maybe a
Nothing,
hiddenModules :: Set ModuleName
hiddenModules = Set ModuleName
forall a. Set a
Set.empty,
reexportedModules :: [ReexportedModule]
reexportedModules = [],
objectDir :: Maybe String
objectDir = Maybe String
forall a. Maybe a
Nothing,
dylibInstallName :: Maybe String
dylibInstallName = Maybe String
forall a. Maybe a
Nothing,
hiDir :: Maybe String
hiDir = Maybe String
forall a. Maybe a
Nothing,
hieDir :: Maybe String
hieDir = Maybe String
forall a. Maybe a
Nothing,
stubDir :: Maybe String
stubDir = Maybe String
forall a. Maybe a
Nothing,
dumpDir :: Maybe String
dumpDir = Maybe String
forall a. Maybe a
Nothing,
objectSuf_ :: String
objectSuf_ = Phase -> String
phaseInputExt Phase
StopLn,
hcSuf :: String
hcSuf = Phase -> String
phaseInputExt Phase
HCc,
hiSuf_ :: String
hiSuf_ = String
"hi",
hieSuf :: String
hieSuf = String
"hie",
dynObjectSuf_ :: String
dynObjectSuf_ = String
"dyn_" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Phase -> String
phaseInputExt Phase
StopLn,
dynHiSuf_ :: String
dynHiSuf_ = String
"dyn_hi",
dynamicNow :: Bool
dynamicNow = Bool
False,
pluginModNames :: [ModuleName]
pluginModNames = [],
pluginModNameOpts :: [(ModuleName, String)]
pluginModNameOpts = [],
frontendPluginOpts :: [String]
frontendPluginOpts = [],
externalPluginSpecs :: [ExternalPluginSpec]
externalPluginSpecs = [],
outputFile_ :: Maybe String
outputFile_ = Maybe String
forall a. Maybe a
Nothing,
dynOutputFile_ :: Maybe String
dynOutputFile_ = Maybe String
forall a. Maybe a
Nothing,
outputHi :: Maybe String
outputHi = Maybe String
forall a. Maybe a
Nothing,
dynOutputHi :: Maybe String
dynOutputHi = Maybe String
forall a. Maybe a
Nothing,
dynLibLoader :: DynLibLoader
dynLibLoader = DynLibLoader
SystemDependent,
dumpPrefix :: String
dumpPrefix = String
"non-module.",
dumpPrefixForce :: Maybe String
dumpPrefixForce = Maybe String
forall a. Maybe a
Nothing,
ldInputs :: [Option]
ldInputs = [],
includePaths :: IncludeSpecs
includePaths = [String] -> [String] -> [String] -> IncludeSpecs
IncludeSpecs [] [] [],
libraryPaths :: [String]
libraryPaths = [],
frameworkPaths :: [String]
frameworkPaths = [],
cmdlineFrameworks :: [String]
cmdlineFrameworks = [],
rtsOpts :: Maybe String
rtsOpts = Maybe String
forall a. Maybe a
Nothing,
rtsOptsEnabled :: RtsOptsEnabled
rtsOptsEnabled = RtsOptsEnabled
RtsOptsSafeOnly,
rtsOptsSuggestions :: Bool
rtsOptsSuggestions = Bool
True,
hpcDir :: String
hpcDir = String
".hpc",
packageDBFlags :: [PackageDBFlag]
packageDBFlags = [],
packageFlags :: [PackageFlag]
packageFlags = [],
pluginPackageFlags :: [PackageFlag]
pluginPackageFlags = [],
ignorePackageFlags :: [IgnorePackageFlag]
ignorePackageFlags = [],
trustFlags :: [TrustFlag]
trustFlags = [],
packageEnv :: Maybe String
packageEnv = Maybe String
forall a. Maybe a
Nothing,
targetWays_ :: Ways
targetWays_ = Ways
forall a. Set a
Set.empty,
splitInfo :: Maybe (String, Int)
splitInfo = Maybe (String, Int)
forall a. Maybe a
Nothing,
ghcNameVersion :: GhcNameVersion
ghcNameVersion = Settings -> GhcNameVersion
sGhcNameVersion Settings
mySettings,
fileSettings :: FileSettings
fileSettings = Settings -> FileSettings
sFileSettings Settings
mySettings,
toolSettings :: ToolSettings
toolSettings = Settings -> ToolSettings
sToolSettings Settings
mySettings,
targetPlatform :: Platform
targetPlatform = Settings -> Platform
sTargetPlatform Settings
mySettings,
platformMisc :: PlatformMisc
platformMisc = Settings -> PlatformMisc
sPlatformMisc Settings
mySettings,
rawSettings :: [(String, String)]
rawSettings = Settings -> [(String, String)]
sRawSettings Settings
mySettings,
tmpDir :: TempDir
tmpDir = String -> TempDir
forall a. HasCallStack => String -> a
panic String
"defaultDynFlags: uninitialized tmpDir",
llvmOptLevel :: Int
llvmOptLevel = Int
0,
depMakefile :: String
depMakefile = String
"Makefile",
depIncludePkgDeps :: Bool
depIncludePkgDeps = Bool
False,
depIncludeCppDeps :: Bool
depIncludeCppDeps = Bool
False,
depExcludeMods :: [ModuleName]
depExcludeMods = [],
depSuffixes :: [String]
depSuffixes = [],
ghcVersionFile :: Maybe String
ghcVersionFile = Maybe String
forall a. Maybe a
Nothing,
haddockOptions :: Maybe String
haddockOptions = Maybe String
forall a. Maybe a
Nothing,
dumpFlags :: EnumSet DumpFlag
dumpFlags = EnumSet DumpFlag
forall {k} (a :: k). EnumSet a
EnumSet.empty,
generalFlags :: EnumSet GeneralFlag
generalFlags = [GeneralFlag] -> EnumSet GeneralFlag
forall a. Enum a => [a] -> EnumSet a
EnumSet.fromList (Settings -> [GeneralFlag]
defaultFlags Settings
mySettings),
warningFlags :: EnumSet WarningFlag
warningFlags = [WarningFlag] -> EnumSet WarningFlag
forall a. Enum a => [a] -> EnumSet a
EnumSet.fromList [WarningFlag]
standardWarnings,
fatalWarningFlags :: EnumSet WarningFlag
fatalWarningFlags = EnumSet WarningFlag
forall {k} (a :: k). EnumSet a
EnumSet.empty,
customWarningCategories :: WarningCategorySet
customWarningCategories = WarningCategorySet
completeWarningCategorySet,
fatalCustomWarningCategories :: WarningCategorySet
fatalCustomWarningCategories = WarningCategorySet
emptyWarningCategorySet,
ghciScripts :: [String]
ghciScripts = [],
language :: Maybe Language
language = Maybe Language
forall a. Maybe a
Nothing,
safeHaskell :: SafeHaskellMode
safeHaskell = SafeHaskellMode
Sf_None,
safeInfer :: Bool
safeInfer = Bool
True,
safeInferred :: Bool
safeInferred = Bool
True,
thOnLoc :: SrcSpan
thOnLoc = SrcSpan
noSrcSpan,
newDerivOnLoc :: SrcSpan
newDerivOnLoc = SrcSpan
noSrcSpan,
deriveViaOnLoc :: SrcSpan
deriveViaOnLoc = SrcSpan
noSrcSpan,
overlapInstLoc :: SrcSpan
overlapInstLoc = SrcSpan
noSrcSpan,
incoherentOnLoc :: SrcSpan
incoherentOnLoc = SrcSpan
noSrcSpan,
pkgTrustOnLoc :: SrcSpan
pkgTrustOnLoc = SrcSpan
noSrcSpan,
warnSafeOnLoc :: SrcSpan
warnSafeOnLoc = SrcSpan
noSrcSpan,
warnUnsafeOnLoc :: SrcSpan
warnUnsafeOnLoc = SrcSpan
noSrcSpan,
trustworthyOnLoc :: SrcSpan
trustworthyOnLoc = SrcSpan
noSrcSpan,
extensions :: [OnOff Extension]
extensions = [],
extensionFlags :: EnumSet Extension
extensionFlags = Maybe Language -> [OnOff Extension] -> EnumSet Extension
flattenExtensionFlags Maybe Language
forall a. Maybe a
Nothing [],
unfoldingOpts :: UnfoldingOpts
unfoldingOpts = UnfoldingOpts
defaultUnfoldingOpts,
maxWorkerArgs :: Int
maxWorkerArgs = Int
10,
maxForcedSpecArgs :: Int
maxForcedSpecArgs = Int
333,
ghciHistSize :: Int
ghciHistSize = Int
50,
flushOut :: FlushOut
flushOut = FlushOut
defaultFlushOut,
pprUserLength :: Int
pprUserLength = Int
5,
pprCols :: Int
pprCols = Int
100,
useUnicode :: Bool
useUnicode = Bool
False,
useColor :: OverridingBool
useColor = OverridingBool
Auto,
canUseColor :: Bool
canUseColor = Bool
False,
useErrorLinks :: OverridingBool
useErrorLinks = OverridingBool
Auto,
canUseErrorLinks :: Bool
canUseErrorLinks = Bool
False,
colScheme :: Scheme
colScheme = Scheme
Col.defaultScheme,
profAuto :: ProfAuto
profAuto = ProfAuto
NoProfAuto,
callerCcFilters :: [CallerCcFilter]
callerCcFilters = [],
interactivePrint :: Maybe String
interactivePrint = Maybe String
forall a. Maybe a
Nothing,
sseVersion :: Maybe SseVersion
sseVersion = Maybe SseVersion
forall a. Maybe a
Nothing,
bmiVersion :: Maybe BmiVersion
bmiVersion = Maybe BmiVersion
forall a. Maybe a
Nothing,
avx :: Bool
avx = Bool
False,
avx2 :: Bool
avx2 = Bool
False,
avx512cd :: Bool
avx512cd = Bool
False,
avx512er :: Bool
avx512er = Bool
False,
avx512f :: Bool
avx512f = Bool
False,
avx512pf :: Bool
avx512pf = Bool
False,
fma :: Bool
fma = (Platform -> Arch
platformArch (Platform -> Arch) -> (Settings -> Platform) -> Settings -> Arch
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Settings -> Platform
sTargetPlatform (Settings -> Arch) -> Settings -> Arch
forall a b. (a -> b) -> a -> b
$ Settings
mySettings) Arch -> Arch -> Bool
forall a. Eq a => a -> a -> Bool
== Arch
ArchAArch64,
maxInlineAllocSize :: Int
maxInlineAllocSize = Int
128,
maxInlineMemcpyInsns :: Int
maxInlineMemcpyInsns = Int
32,
maxInlineMemsetInsns :: Int
maxInlineMemsetInsns = Int
32,
initialUnique :: Word64
initialUnique = Word64
0,
uniqueIncrement :: Int
uniqueIncrement = Int
1,
reverseErrors :: Bool
reverseErrors = Bool
False,
maxErrors :: Maybe Int
maxErrors = Maybe Int
forall a. Maybe a
Nothing,
cfgWeights :: Weights
cfgWeights = Weights
defaultWeights
}
type FatalMessager = String -> IO ()
defaultFatalMessager :: FatalMessager
defaultFatalMessager :: FatalMessager
defaultFatalMessager = Handle -> FatalMessager
hPutStrLn Handle
stderr
newtype FlushOut = FlushOut (IO ())
defaultFlushOut :: FlushOut
defaultFlushOut :: FlushOut
defaultFlushOut = IO () -> FlushOut
FlushOut (IO () -> FlushOut) -> IO () -> FlushOut
forall a b. (a -> b) -> a -> b
$ Handle -> IO ()
hFlush Handle
stdout
data OnOff a = On a
| Off a
deriving (OnOff a -> OnOff a -> Bool
(OnOff a -> OnOff a -> Bool)
-> (OnOff a -> OnOff a -> Bool) -> Eq (OnOff a)
forall a. Eq a => OnOff a -> OnOff a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => OnOff a -> OnOff a -> Bool
== :: OnOff a -> OnOff a -> Bool
$c/= :: forall a. Eq a => OnOff a -> OnOff a -> Bool
/= :: OnOff a -> OnOff a -> Bool
Eq, Int -> OnOff a -> String -> String
[OnOff a] -> String -> String
OnOff a -> String
(Int -> OnOff a -> String -> String)
-> (OnOff a -> String)
-> ([OnOff a] -> String -> String)
-> Show (OnOff a)
forall a. Show a => Int -> OnOff a -> String -> String
forall a. Show a => [OnOff a] -> String -> String
forall a. Show a => OnOff a -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: forall a. Show a => Int -> OnOff a -> String -> String
showsPrec :: Int -> OnOff a -> String -> String
$cshow :: forall a. Show a => OnOff a -> String
show :: OnOff a -> String
$cshowList :: forall a. Show a => [OnOff a] -> String -> String
showList :: [OnOff a] -> String -> String
Show)
instance Outputable a => Outputable (OnOff a) where
ppr :: OnOff a -> SDoc
ppr (On a
x) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"On" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
x
ppr (Off a
x) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Off" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
x
flattenExtensionFlags :: Maybe Language -> [OnOff LangExt.Extension] -> EnumSet LangExt.Extension
flattenExtensionFlags :: Maybe Language -> [OnOff Extension] -> EnumSet Extension
flattenExtensionFlags Maybe Language
ml = (OnOff Extension -> EnumSet Extension -> EnumSet Extension)
-> EnumSet Extension -> [OnOff Extension] -> EnumSet Extension
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr OnOff Extension -> EnumSet Extension -> EnumSet Extension
forall {a}. Enum a => OnOff a -> EnumSet a -> EnumSet a
g EnumSet Extension
defaultExtensionFlags
where g :: OnOff a -> EnumSet a -> EnumSet a
g (On a
f) EnumSet a
flags = a -> EnumSet a -> EnumSet a
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.insert a
f EnumSet a
flags
g (Off a
f) EnumSet a
flags = a -> EnumSet a -> EnumSet a
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.delete a
f EnumSet a
flags
defaultExtensionFlags :: EnumSet Extension
defaultExtensionFlags = [Extension] -> EnumSet Extension
forall a. Enum a => [a] -> EnumSet a
EnumSet.fromList (Maybe Language -> [Extension]
languageExtensions Maybe Language
ml)
data ParMakeCount
= ParMakeThisMany Int
| ParMakeNumProcessors
| ParMakeSemaphore FilePath
data GhcMode
= CompManager
| OneShot
| MkDepend
deriving GhcMode -> GhcMode -> Bool
(GhcMode -> GhcMode -> Bool)
-> (GhcMode -> GhcMode -> Bool) -> Eq GhcMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GhcMode -> GhcMode -> Bool
== :: GhcMode -> GhcMode -> Bool
$c/= :: GhcMode -> GhcMode -> Bool
/= :: GhcMode -> GhcMode -> Bool
Eq
instance Outputable GhcMode where
ppr :: GhcMode -> SDoc
ppr GhcMode
CompManager = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"CompManager"
ppr GhcMode
OneShot = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"OneShot"
ppr GhcMode
MkDepend = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"MkDepend"
isOneShot :: GhcMode -> Bool
isOneShot :: GhcMode -> Bool
isOneShot GhcMode
OneShot = Bool
True
isOneShot GhcMode
_other = Bool
False
data GhcLink
= NoLink
| LinkBinary
| LinkInMemory
| LinkDynLib
| LinkStaticLib
| LinkMergedObj
deriving (GhcLink -> GhcLink -> Bool
(GhcLink -> GhcLink -> Bool)
-> (GhcLink -> GhcLink -> Bool) -> Eq GhcLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GhcLink -> GhcLink -> Bool
== :: GhcLink -> GhcLink -> Bool
$c/= :: GhcLink -> GhcLink -> Bool
/= :: GhcLink -> GhcLink -> Bool
Eq, Int -> GhcLink -> String -> String
[GhcLink] -> String -> String
GhcLink -> String
(Int -> GhcLink -> String -> String)
-> (GhcLink -> String)
-> ([GhcLink] -> String -> String)
-> Show GhcLink
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> GhcLink -> String -> String
showsPrec :: Int -> GhcLink -> String -> String
$cshow :: GhcLink -> String
show :: GhcLink -> String
$cshowList :: [GhcLink] -> String -> String
showList :: [GhcLink] -> String -> String
Show)
isNoLink :: GhcLink -> Bool
isNoLink :: GhcLink -> Bool
isNoLink GhcLink
NoLink = Bool
True
isNoLink GhcLink
_ = Bool
False
data PackageArg =
PackageArg String
| UnitIdArg Unit
deriving (PackageArg -> PackageArg -> Bool
(PackageArg -> PackageArg -> Bool)
-> (PackageArg -> PackageArg -> Bool) -> Eq PackageArg
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PackageArg -> PackageArg -> Bool
== :: PackageArg -> PackageArg -> Bool
$c/= :: PackageArg -> PackageArg -> Bool
/= :: PackageArg -> PackageArg -> Bool
Eq, Int -> PackageArg -> String -> String
[PackageArg] -> String -> String
PackageArg -> String
(Int -> PackageArg -> String -> String)
-> (PackageArg -> String)
-> ([PackageArg] -> String -> String)
-> Show PackageArg
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> PackageArg -> String -> String
showsPrec :: Int -> PackageArg -> String -> String
$cshow :: PackageArg -> String
show :: PackageArg -> String
$cshowList :: [PackageArg] -> String -> String
showList :: [PackageArg] -> String -> String
Show)
instance Outputable PackageArg where
ppr :: PackageArg -> SDoc
ppr (PackageArg String
pn) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"package" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
pn
ppr (UnitIdArg Unit
uid) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"unit" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Unit -> SDoc
forall a. Outputable a => a -> SDoc
ppr Unit
uid
data ModRenaming = ModRenaming {
ModRenaming -> Bool
modRenamingWithImplicit :: Bool,
ModRenaming -> [(ModuleName, ModuleName)]
modRenamings :: [(ModuleName, ModuleName)]
} deriving (ModRenaming -> ModRenaming -> Bool
(ModRenaming -> ModRenaming -> Bool)
-> (ModRenaming -> ModRenaming -> Bool) -> Eq ModRenaming
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ModRenaming -> ModRenaming -> Bool
== :: ModRenaming -> ModRenaming -> Bool
$c/= :: ModRenaming -> ModRenaming -> Bool
/= :: ModRenaming -> ModRenaming -> Bool
Eq)
instance Outputable ModRenaming where
ppr :: ModRenaming -> SDoc
ppr (ModRenaming Bool
b [(ModuleName, ModuleName)]
rns) = Bool -> SDoc
forall a. Outputable a => a -> SDoc
ppr Bool
b SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens ([(ModuleName, ModuleName)] -> SDoc
forall a. Outputable a => a -> SDoc
ppr [(ModuleName, ModuleName)]
rns)
newtype IgnorePackageFlag = IgnorePackage String
deriving (IgnorePackageFlag -> IgnorePackageFlag -> Bool
(IgnorePackageFlag -> IgnorePackageFlag -> Bool)
-> (IgnorePackageFlag -> IgnorePackageFlag -> Bool)
-> Eq IgnorePackageFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IgnorePackageFlag -> IgnorePackageFlag -> Bool
== :: IgnorePackageFlag -> IgnorePackageFlag -> Bool
$c/= :: IgnorePackageFlag -> IgnorePackageFlag -> Bool
/= :: IgnorePackageFlag -> IgnorePackageFlag -> Bool
Eq)
data TrustFlag
= TrustPackage String
| DistrustPackage String
deriving (TrustFlag -> TrustFlag -> Bool
(TrustFlag -> TrustFlag -> Bool)
-> (TrustFlag -> TrustFlag -> Bool) -> Eq TrustFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TrustFlag -> TrustFlag -> Bool
== :: TrustFlag -> TrustFlag -> Bool
$c/= :: TrustFlag -> TrustFlag -> Bool
/= :: TrustFlag -> TrustFlag -> Bool
Eq)
data PackageFlag
= ExposePackage String PackageArg ModRenaming
| HidePackage String
deriving (PackageFlag -> PackageFlag -> Bool
(PackageFlag -> PackageFlag -> Bool)
-> (PackageFlag -> PackageFlag -> Bool) -> Eq PackageFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PackageFlag -> PackageFlag -> Bool
== :: PackageFlag -> PackageFlag -> Bool
$c/= :: PackageFlag -> PackageFlag -> Bool
/= :: PackageFlag -> PackageFlag -> Bool
Eq)
data PackageDBFlag
= PackageDB PkgDbRef
| NoUserPackageDB
| NoGlobalPackageDB
| ClearPackageDBs
deriving (PackageDBFlag -> PackageDBFlag -> Bool
(PackageDBFlag -> PackageDBFlag -> Bool)
-> (PackageDBFlag -> PackageDBFlag -> Bool) -> Eq PackageDBFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PackageDBFlag -> PackageDBFlag -> Bool
== :: PackageDBFlag -> PackageDBFlag -> Bool
$c/= :: PackageDBFlag -> PackageDBFlag -> Bool
/= :: PackageDBFlag -> PackageDBFlag -> Bool
Eq)
packageFlagsChanged :: DynFlags -> DynFlags -> Bool
packageFlagsChanged :: DynFlags -> DynFlags -> Bool
packageFlagsChanged DynFlags
idflags1 DynFlags
idflags0 =
DynFlags -> [PackageFlag]
packageFlags DynFlags
idflags1 [PackageFlag] -> [PackageFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [PackageFlag]
packageFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
DynFlags -> [IgnorePackageFlag]
ignorePackageFlags DynFlags
idflags1 [IgnorePackageFlag] -> [IgnorePackageFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [IgnorePackageFlag]
ignorePackageFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
DynFlags -> [PackageFlag]
pluginPackageFlags DynFlags
idflags1 [PackageFlag] -> [PackageFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [PackageFlag]
pluginPackageFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
DynFlags -> [TrustFlag]
trustFlags DynFlags
idflags1 [TrustFlag] -> [TrustFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [TrustFlag]
trustFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
DynFlags -> [PackageDBFlag]
packageDBFlags DynFlags
idflags1 [PackageDBFlag] -> [PackageDBFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [PackageDBFlag]
packageDBFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
DynFlags -> [Bool]
packageGFlags DynFlags
idflags1 [Bool] -> [Bool] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [Bool]
packageGFlags DynFlags
idflags0
where
packageGFlags :: DynFlags -> [Bool]
packageGFlags DynFlags
dflags = (GeneralFlag -> Bool) -> [GeneralFlag] -> [Bool]
forall a b. (a -> b) -> [a] -> [b]
map (GeneralFlag -> DynFlags -> Bool
`gopt` DynFlags
dflags)
[ GeneralFlag
Opt_HideAllPackages
, GeneralFlag
Opt_HideAllPluginPackages
, GeneralFlag
Opt_AutoLinkPackages ]
instance Outputable PackageFlag where
ppr :: PackageFlag -> SDoc
ppr (ExposePackage String
n PackageArg
arg ModRenaming
rn) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
n SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (PackageArg -> SDoc
forall a. Outputable a => a -> SDoc
ppr PackageArg
arg SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModRenaming -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModRenaming
rn)
ppr (HidePackage String
str) = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"-hide-package" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
str
data DynLibLoader
= Deployable
| SystemDependent
deriving DynLibLoader -> DynLibLoader -> Bool
(DynLibLoader -> DynLibLoader -> Bool)
-> (DynLibLoader -> DynLibLoader -> Bool) -> Eq DynLibLoader
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DynLibLoader -> DynLibLoader -> Bool
== :: DynLibLoader -> DynLibLoader -> Bool
$c/= :: DynLibLoader -> DynLibLoader -> Bool
/= :: DynLibLoader -> DynLibLoader -> Bool
Eq
data RtsOptsEnabled
= RtsOptsNone | RtsOptsIgnore | RtsOptsIgnoreAll | RtsOptsSafeOnly
| RtsOptsAll
deriving (Int -> RtsOptsEnabled -> String -> String
[RtsOptsEnabled] -> String -> String
RtsOptsEnabled -> String
(Int -> RtsOptsEnabled -> String -> String)
-> (RtsOptsEnabled -> String)
-> ([RtsOptsEnabled] -> String -> String)
-> Show RtsOptsEnabled
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> RtsOptsEnabled -> String -> String
showsPrec :: Int -> RtsOptsEnabled -> String -> String
$cshow :: RtsOptsEnabled -> String
show :: RtsOptsEnabled -> String
$cshowList :: [RtsOptsEnabled] -> String -> String
showList :: [RtsOptsEnabled] -> String -> String
Show)
positionIndependent :: DynFlags -> Bool
positionIndependent :: DynFlags -> Bool
positionIndependent DynFlags
dflags = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags Bool -> Bool -> Bool
|| GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIE DynFlags
dflags
data DynamicTooState
= DT_Dont
| DT_OK
| DT_Dyn
deriving (DynamicTooState -> DynamicTooState -> Bool
(DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> Eq DynamicTooState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DynamicTooState -> DynamicTooState -> Bool
== :: DynamicTooState -> DynamicTooState -> Bool
$c/= :: DynamicTooState -> DynamicTooState -> Bool
/= :: DynamicTooState -> DynamicTooState -> Bool
Eq,Int -> DynamicTooState -> String -> String
[DynamicTooState] -> String -> String
DynamicTooState -> String
(Int -> DynamicTooState -> String -> String)
-> (DynamicTooState -> String)
-> ([DynamicTooState] -> String -> String)
-> Show DynamicTooState
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> DynamicTooState -> String -> String
showsPrec :: Int -> DynamicTooState -> String -> String
$cshow :: DynamicTooState -> String
show :: DynamicTooState -> String
$cshowList :: [DynamicTooState] -> String -> String
showList :: [DynamicTooState] -> String -> String
Show,Eq DynamicTooState
Eq DynamicTooState =>
(DynamicTooState -> DynamicTooState -> Ordering)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> DynamicTooState)
-> (DynamicTooState -> DynamicTooState -> DynamicTooState)
-> Ord DynamicTooState
DynamicTooState -> DynamicTooState -> Bool
DynamicTooState -> DynamicTooState -> Ordering
DynamicTooState -> DynamicTooState -> DynamicTooState
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: DynamicTooState -> DynamicTooState -> Ordering
compare :: DynamicTooState -> DynamicTooState -> Ordering
$c< :: DynamicTooState -> DynamicTooState -> Bool
< :: DynamicTooState -> DynamicTooState -> Bool
$c<= :: DynamicTooState -> DynamicTooState -> Bool
<= :: DynamicTooState -> DynamicTooState -> Bool
$c> :: DynamicTooState -> DynamicTooState -> Bool
> :: DynamicTooState -> DynamicTooState -> Bool
$c>= :: DynamicTooState -> DynamicTooState -> Bool
>= :: DynamicTooState -> DynamicTooState -> Bool
$cmax :: DynamicTooState -> DynamicTooState -> DynamicTooState
max :: DynamicTooState -> DynamicTooState -> DynamicTooState
$cmin :: DynamicTooState -> DynamicTooState -> DynamicTooState
min :: DynamicTooState -> DynamicTooState -> DynamicTooState
Ord)
dynamicTooState :: DynFlags -> DynamicTooState
dynamicTooState :: DynFlags -> DynamicTooState
dynamicTooState DynFlags
dflags
| Bool -> Bool
not (GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_BuildDynamicToo DynFlags
dflags) = DynamicTooState
DT_Dont
| DynFlags -> Bool
dynamicNow DynFlags
dflags = DynamicTooState
DT_Dyn
| Bool
otherwise = DynamicTooState
DT_OK
setDynamicNow :: DynFlags -> DynFlags
setDynamicNow :: DynFlags -> DynFlags
setDynamicNow DynFlags
dflags0 =
DynFlags
dflags0
{ dynamicNow = True
}
data PkgDbRef
= GlobalPkgDb
| UserPkgDb
| PkgDbPath FilePath
deriving PkgDbRef -> PkgDbRef -> Bool
(PkgDbRef -> PkgDbRef -> Bool)
-> (PkgDbRef -> PkgDbRef -> Bool) -> Eq PkgDbRef
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PkgDbRef -> PkgDbRef -> Bool
== :: PkgDbRef -> PkgDbRef -> Bool
$c/= :: PkgDbRef -> PkgDbRef -> Bool
/= :: PkgDbRef -> PkgDbRef -> Bool
Eq
data IncludeSpecs
= IncludeSpecs { IncludeSpecs -> [String]
includePathsQuote :: [String]
, IncludeSpecs -> [String]
includePathsGlobal :: [String]
, IncludeSpecs -> [String]
includePathsQuoteImplicit :: [String]
}
deriving Int -> IncludeSpecs -> String -> String
[IncludeSpecs] -> String -> String
IncludeSpecs -> String
(Int -> IncludeSpecs -> String -> String)
-> (IncludeSpecs -> String)
-> ([IncludeSpecs] -> String -> String)
-> Show IncludeSpecs
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> IncludeSpecs -> String -> String
showsPrec :: Int -> IncludeSpecs -> String -> String
$cshow :: IncludeSpecs -> String
show :: IncludeSpecs -> String
$cshowList :: [IncludeSpecs] -> String -> String
showList :: [IncludeSpecs] -> String -> String
Show
addGlobalInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addGlobalInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addGlobalInclude IncludeSpecs
spec [String]
paths = let f :: [String]
f = IncludeSpecs -> [String]
includePathsGlobal IncludeSpecs
spec
in IncludeSpecs
spec { includePathsGlobal = f ++ paths }
addQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addQuoteInclude IncludeSpecs
spec [String]
paths = let f :: [String]
f = IncludeSpecs -> [String]
includePathsQuote IncludeSpecs
spec
in IncludeSpecs
spec { includePathsQuote = f ++ paths }
addImplicitQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addImplicitQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addImplicitQuoteInclude IncludeSpecs
spec [String]
paths = let f :: [String]
f = IncludeSpecs -> [String]
includePathsQuoteImplicit IncludeSpecs
spec
in IncludeSpecs
spec { includePathsQuoteImplicit = f ++ paths }
flattenIncludes :: IncludeSpecs -> [String]
flattenIncludes :: IncludeSpecs -> [String]
flattenIncludes IncludeSpecs
specs =
IncludeSpecs -> [String]
includePathsQuote IncludeSpecs
specs [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
IncludeSpecs -> [String]
includePathsQuoteImplicit IncludeSpecs
specs [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
IncludeSpecs -> [String]
includePathsGlobal IncludeSpecs
specs
data ReexportedModule = ReexportedModule { ReexportedModule -> ModuleName
reexportFrom :: ModuleName
, ReexportedModule -> ModuleName
reexportTo :: ModuleName
}
instance Outputable ReexportedModule where
ppr :: ReexportedModule -> SDoc
ppr (ReexportedModule ModuleName
from ModuleName
to) =
if ModuleName
from ModuleName -> ModuleName -> Bool
forall a. Eq a => a -> a -> Bool
== ModuleName
to then ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
from
else ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
from SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"as" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
to
hasPprDebug :: DynFlags -> Bool
hasPprDebug :: DynFlags -> Bool
hasPprDebug = DumpFlag -> DynFlags -> Bool
dopt DumpFlag
Opt_D_ppr_debug
hasNoDebugOutput :: DynFlags -> Bool
hasNoDebugOutput :: DynFlags -> Bool
hasNoDebugOutput = DumpFlag -> DynFlags -> Bool
dopt DumpFlag
Opt_D_no_debug_output
hasNoStateHack :: DynFlags -> Bool
hasNoStateHack :: DynFlags -> Bool
hasNoStateHack = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_G_NoStateHack
hasNoOptCoercion :: DynFlags -> Bool
hasNoOptCoercion :: DynFlags -> Bool
hasNoOptCoercion = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_G_NoOptCoercion
dopt :: DumpFlag -> DynFlags -> Bool
dopt :: DumpFlag -> DynFlags -> Bool
dopt = (DynFlags -> Int)
-> (DynFlags -> EnumSet DumpFlag) -> DumpFlag -> DynFlags -> Bool
forall a.
(a -> Int) -> (a -> EnumSet DumpFlag) -> DumpFlag -> a -> Bool
getDumpFlagFrom DynFlags -> Int
verbosity DynFlags -> EnumSet DumpFlag
dumpFlags
dopt_set :: DynFlags -> DumpFlag -> DynFlags
dopt_set :: DynFlags -> DumpFlag -> DynFlags
dopt_set DynFlags
dfs DumpFlag
f = DynFlags
dfs{ dumpFlags = EnumSet.insert f (dumpFlags dfs) }
dopt_unset :: DynFlags -> DumpFlag -> DynFlags
dopt_unset :: DynFlags -> DumpFlag -> DynFlags
dopt_unset DynFlags
dfs DumpFlag
f = DynFlags
dfs{ dumpFlags = EnumSet.delete f (dumpFlags dfs) }
gopt :: GeneralFlag -> DynFlags -> Bool
gopt :: GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags
| DynFlags -> Bool
dynamicNow DynFlags
dflags = Bool
True
gopt GeneralFlag
Opt_ExternalDynamicRefs DynFlags
dflags
| DynFlags -> Bool
dynamicNow DynFlags
dflags = Bool
True
gopt GeneralFlag
Opt_SplitSections DynFlags
dflags
| DynFlags -> Bool
dynamicNow DynFlags
dflags = Bool
False
gopt GeneralFlag
f DynFlags
dflags = GeneralFlag
f GeneralFlag -> EnumSet GeneralFlag -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet GeneralFlag
generalFlags DynFlags
dflags
gopt_set :: DynFlags -> GeneralFlag -> DynFlags
gopt_set :: DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dfs GeneralFlag
f = DynFlags
dfs{ generalFlags = EnumSet.insert f (generalFlags dfs) }
gopt_unset :: DynFlags -> GeneralFlag -> DynFlags
gopt_unset :: DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dfs GeneralFlag
f = DynFlags
dfs{ generalFlags = EnumSet.delete f (generalFlags dfs) }
wopt :: WarningFlag -> DynFlags -> Bool
wopt :: WarningFlag -> DynFlags -> Bool
wopt WarningFlag
f DynFlags
dflags = WarningFlag
f WarningFlag -> EnumSet WarningFlag -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet WarningFlag
warningFlags DynFlags
dflags
wopt_set :: DynFlags -> WarningFlag -> DynFlags
wopt_set :: DynFlags -> WarningFlag -> DynFlags
wopt_set DynFlags
dfs WarningFlag
f = DynFlags
dfs{ warningFlags = EnumSet.insert f (warningFlags dfs) }
wopt_unset :: DynFlags -> WarningFlag -> DynFlags
wopt_unset :: DynFlags -> WarningFlag -> DynFlags
wopt_unset DynFlags
dfs WarningFlag
f = DynFlags
dfs{ warningFlags = EnumSet.delete f (warningFlags dfs) }
wopt_fatal :: WarningFlag -> DynFlags -> Bool
wopt_fatal :: WarningFlag -> DynFlags -> Bool
wopt_fatal WarningFlag
f DynFlags
dflags = WarningFlag
f WarningFlag -> EnumSet WarningFlag -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet WarningFlag
fatalWarningFlags DynFlags
dflags
wopt_set_fatal :: DynFlags -> WarningFlag -> DynFlags
wopt_set_fatal :: DynFlags -> WarningFlag -> DynFlags
wopt_set_fatal DynFlags
dfs WarningFlag
f
= DynFlags
dfs { fatalWarningFlags = EnumSet.insert f (fatalWarningFlags dfs) }
wopt_unset_fatal :: DynFlags -> WarningFlag -> DynFlags
wopt_unset_fatal :: DynFlags -> WarningFlag -> DynFlags
wopt_unset_fatal DynFlags
dfs WarningFlag
f
= DynFlags
dfs { fatalWarningFlags = EnumSet.delete f (fatalWarningFlags dfs) }
wopt_set_all_custom :: DynFlags -> DynFlags
wopt_set_all_custom :: DynFlags -> DynFlags
wopt_set_all_custom DynFlags
dfs
= DynFlags
dfs{ customWarningCategories = completeWarningCategorySet }
wopt_unset_all_custom :: DynFlags -> DynFlags
wopt_unset_all_custom :: DynFlags -> DynFlags
wopt_unset_all_custom DynFlags
dfs
= DynFlags
dfs{ customWarningCategories = emptyWarningCategorySet }
wopt_set_all_fatal_custom :: DynFlags -> DynFlags
wopt_set_all_fatal_custom :: DynFlags -> DynFlags
wopt_set_all_fatal_custom DynFlags
dfs
= DynFlags
dfs { fatalCustomWarningCategories = completeWarningCategorySet }
wopt_unset_all_fatal_custom :: DynFlags -> DynFlags
wopt_unset_all_fatal_custom :: DynFlags -> DynFlags
wopt_unset_all_fatal_custom DynFlags
dfs
= DynFlags
dfs { fatalCustomWarningCategories = emptyWarningCategorySet }
wopt_set_custom :: DynFlags -> WarningCategory -> DynFlags
wopt_set_custom :: DynFlags -> WarningCategory -> DynFlags
wopt_set_custom DynFlags
dfs WarningCategory
f = DynFlags
dfs{ customWarningCategories = insertWarningCategorySet f (customWarningCategories dfs) }
wopt_unset_custom :: DynFlags -> WarningCategory -> DynFlags
wopt_unset_custom :: DynFlags -> WarningCategory -> DynFlags
wopt_unset_custom DynFlags
dfs WarningCategory
f = DynFlags
dfs{ customWarningCategories = deleteWarningCategorySet f (customWarningCategories dfs) }
wopt_set_fatal_custom :: DynFlags -> WarningCategory -> DynFlags
wopt_set_fatal_custom :: DynFlags -> WarningCategory -> DynFlags
wopt_set_fatal_custom DynFlags
dfs WarningCategory
f
= DynFlags
dfs { fatalCustomWarningCategories = insertWarningCategorySet f (fatalCustomWarningCategories dfs) }
wopt_unset_fatal_custom :: DynFlags -> WarningCategory -> DynFlags
wopt_unset_fatal_custom :: DynFlags -> WarningCategory -> DynFlags
wopt_unset_fatal_custom DynFlags
dfs WarningCategory
f
= DynFlags
dfs { fatalCustomWarningCategories = deleteWarningCategorySet f (fatalCustomWarningCategories dfs) }
wopt_any_custom :: DynFlags -> Bool
wopt_any_custom :: DynFlags -> Bool
wopt_any_custom DynFlags
dfs = Bool -> Bool
not (WarningCategorySet -> Bool
nullWarningCategorySet (DynFlags -> WarningCategorySet
customWarningCategories DynFlags
dfs))
xopt :: LangExt.Extension -> DynFlags -> Bool
xopt :: Extension -> DynFlags -> Bool
xopt Extension
f DynFlags
dflags = Extension
f Extension -> EnumSet Extension -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet Extension
extensionFlags DynFlags
dflags
xopt_set :: DynFlags -> LangExt.Extension -> DynFlags
xopt_set :: DynFlags -> Extension -> DynFlags
xopt_set DynFlags
dfs Extension
f
= let onoffs :: [OnOff Extension]
onoffs = Extension -> OnOff Extension
forall a. a -> OnOff a
On Extension
f OnOff Extension -> [OnOff Extension] -> [OnOff Extension]
forall a. a -> [a] -> [a]
: DynFlags -> [OnOff Extension]
extensions DynFlags
dfs
in DynFlags
dfs { extensions = onoffs,
extensionFlags = flattenExtensionFlags (language dfs) onoffs }
xopt_unset :: DynFlags -> LangExt.Extension -> DynFlags
xopt_unset :: DynFlags -> Extension -> DynFlags
xopt_unset DynFlags
dfs Extension
f
= let onoffs :: [OnOff Extension]
onoffs = Extension -> OnOff Extension
forall a. a -> OnOff a
Off Extension
f OnOff Extension -> [OnOff Extension] -> [OnOff Extension]
forall a. a -> [a] -> [a]
: DynFlags -> [OnOff Extension]
extensions DynFlags
dfs
in DynFlags
dfs { extensions = onoffs,
extensionFlags = flattenExtensionFlags (language dfs) onoffs }
xopt_set_unlessExplSpec
:: LangExt.Extension
-> (DynFlags -> LangExt.Extension -> DynFlags)
-> DynFlags -> DynFlags
xopt_set_unlessExplSpec :: Extension
-> (DynFlags -> Extension -> DynFlags) -> DynFlags -> DynFlags
xopt_set_unlessExplSpec Extension
ext DynFlags -> Extension -> DynFlags
setUnset DynFlags
dflags =
let referedExts :: [Extension]
referedExts = OnOff Extension -> Extension
forall {a}. OnOff a -> a
stripOnOff (OnOff Extension -> Extension) -> [OnOff Extension] -> [Extension]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> DynFlags -> [OnOff Extension]
extensions DynFlags
dflags
stripOnOff :: OnOff a -> a
stripOnOff (On a
x) = a
x
stripOnOff (Off a
x) = a
x
in
if Extension
ext Extension -> [Extension] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Extension]
referedExts then DynFlags
dflags else DynFlags -> Extension -> DynFlags
setUnset DynFlags
dflags Extension
ext
xopt_DuplicateRecordFields :: DynFlags -> FieldLabel.DuplicateRecordFields
xopt_DuplicateRecordFields :: DynFlags -> DuplicateRecordFields
xopt_DuplicateRecordFields DynFlags
dfs
| Extension -> DynFlags -> Bool
xopt Extension
LangExt.DuplicateRecordFields DynFlags
dfs = DuplicateRecordFields
FieldLabel.DuplicateRecordFields
| Bool
otherwise = DuplicateRecordFields
FieldLabel.NoDuplicateRecordFields
xopt_FieldSelectors :: DynFlags -> FieldLabel.FieldSelectors
xopt_FieldSelectors :: DynFlags -> FieldSelectors
xopt_FieldSelectors DynFlags
dfs
| Extension -> DynFlags -> Bool
xopt Extension
LangExt.FieldSelectors DynFlags
dfs = FieldSelectors
FieldLabel.FieldSelectors
| Bool
otherwise = FieldSelectors
FieldLabel.NoFieldSelectors
lang_set :: DynFlags -> Maybe Language -> DynFlags
lang_set :: DynFlags -> Maybe Language -> DynFlags
lang_set DynFlags
dflags Maybe Language
lang =
DynFlags
dflags {
language = lang,
extensionFlags = flattenExtensionFlags lang (extensions dflags)
}
defaultFlags :: Settings -> [GeneralFlag]
defaultFlags :: Settings -> [GeneralFlag]
defaultFlags Settings
settings
= [ GeneralFlag
Opt_AutoLinkPackages,
GeneralFlag
Opt_DiagnosticsShowCaret,
GeneralFlag
Opt_EmbedManifest,
GeneralFlag
Opt_FamAppCache,
GeneralFlag
Opt_GenManifest,
GeneralFlag
Opt_GhciHistory,
GeneralFlag
Opt_GhciSandbox,
GeneralFlag
Opt_HelpfulErrors,
GeneralFlag
Opt_KeepHiFiles,
GeneralFlag
Opt_KeepOFiles,
GeneralFlag
Opt_OmitYields,
GeneralFlag
Opt_PrintBindContents,
GeneralFlag
Opt_ProfCountEntries,
GeneralFlag
Opt_SharedImplib,
GeneralFlag
Opt_SimplPreInlining,
GeneralFlag
Opt_VersionMacros,
GeneralFlag
Opt_RPath,
GeneralFlag
Opt_DumpWithWays,
GeneralFlag
Opt_CompactUnwind,
GeneralFlag
Opt_ShowErrorContext,
GeneralFlag
Opt_SuppressStgReps,
GeneralFlag
Opt_UnoptimizedCoreForInterpreter,
GeneralFlag
Opt_SpecialiseIncoherents
]
[GeneralFlag] -> [GeneralFlag] -> [GeneralFlag]
forall a. [a] -> [a] -> [a]
++ [GeneralFlag
f | ([Int]
ns,GeneralFlag
f) <- [([Int], GeneralFlag)]
optLevelFlags, Int
0 Int -> [Int] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Int]
ns]
[GeneralFlag] -> [GeneralFlag] -> [GeneralFlag]
forall a. [a] -> [a] -> [a]
++ [ GeneralFlag
Opt_LocalFloatOut, GeneralFlag
Opt_LocalFloatOutTopLevel ]
[GeneralFlag] -> [GeneralFlag] -> [GeneralFlag]
forall a. [a] -> [a] -> [a]
++ Platform -> [GeneralFlag]
default_PIC Platform
platform
[GeneralFlag] -> [GeneralFlag] -> [GeneralFlag]
forall a. [a] -> [a] -> [a]
++ [GeneralFlag]
validHoleFitDefaults
where platform :: Platform
platform = Settings -> Platform
sTargetPlatform Settings
settings
validHoleFitDefaults :: [GeneralFlag]
validHoleFitDefaults :: [GeneralFlag]
validHoleFitDefaults
= [ GeneralFlag
Opt_ShowTypeAppOfHoleFits
, GeneralFlag
Opt_ShowTypeOfHoleFits
, GeneralFlag
Opt_ShowProvOfHoleFits
, GeneralFlag
Opt_ShowMatchesOfHoleFits
, GeneralFlag
Opt_ShowValidHoleFits
, GeneralFlag
Opt_SortValidHoleFits
, GeneralFlag
Opt_SortBySizeHoleFits
, GeneralFlag
Opt_ShowHoleConstraints ]
optLevelFlags :: [([Int], GeneralFlag)]
optLevelFlags :: [([Int], GeneralFlag)]
optLevelFlags
= [ ([Int
0,Int
1,Int
2], GeneralFlag
Opt_DoLambdaEtaExpansion)
, ([Int
1,Int
2], GeneralFlag
Opt_DoCleverArgEtaExpansion)
, ([Int
0,Int
1,Int
2], GeneralFlag
Opt_DoEtaReduction)
, ([Int
0,Int
1,Int
2], GeneralFlag
Opt_ProfManualCcs )
, ([Int
2], GeneralFlag
Opt_DictsStrict)
, ([Int
0], GeneralFlag
Opt_IgnoreInterfacePragmas)
, ([Int
0], GeneralFlag
Opt_OmitInterfacePragmas)
, ([Int
1,Int
2], GeneralFlag
Opt_CoreConstantFolding)
, ([Int
1,Int
2], GeneralFlag
Opt_CallArity)
, ([Int
1,Int
2], GeneralFlag
Opt_Exitification)
, ([Int
1,Int
2], GeneralFlag
Opt_CaseMerge)
, ([Int
1,Int
2], GeneralFlag
Opt_CaseFolding)
, ([Int
1,Int
2], GeneralFlag
Opt_CmmElimCommonBlocks)
, ([Int
2], GeneralFlag
Opt_AsmShortcutting)
, ([Int
1,Int
2], GeneralFlag
Opt_CmmSink)
, ([Int
1,Int
2], GeneralFlag
Opt_CmmStaticPred)
, ([Int
1,Int
2], GeneralFlag
Opt_CSE)
, ([Int
1,Int
2], GeneralFlag
Opt_StgCSE)
, ([Int
2], GeneralFlag
Opt_StgLiftLams)
, ([Int
1,Int
2], GeneralFlag
Opt_CmmControlFlow)
, ([Int
1,Int
2], GeneralFlag
Opt_EnableRewriteRules)
, ([Int
1,Int
2], GeneralFlag
Opt_FloatIn)
, ([Int
1,Int
2], GeneralFlag
Opt_FullLaziness)
, ([Int
1,Int
2], GeneralFlag
Opt_IgnoreAsserts)
, ([Int
1,Int
2], GeneralFlag
Opt_Loopification)
, ([Int
1,Int
2], GeneralFlag
Opt_CfgBlocklayout)
, ([Int
1,Int
2], GeneralFlag
Opt_Specialise)
, ([Int
1,Int
2], GeneralFlag
Opt_CrossModuleSpecialise)
, ([Int
1,Int
2], GeneralFlag
Opt_InlineGenerics)
, ([Int
1,Int
2], GeneralFlag
Opt_Strictness)
, ([Int
1,Int
2], GeneralFlag
Opt_UnboxSmallStrictFields)
, ([Int
1,Int
2], GeneralFlag
Opt_CprAnal)
, ([Int
1,Int
2], GeneralFlag
Opt_WorkerWrapper)
, ([Int
1,Int
2], GeneralFlag
Opt_SolveConstantDicts)
, ([Int
1,Int
2], GeneralFlag
Opt_NumConstantFolding)
, ([Int
2], GeneralFlag
Opt_LiberateCase)
, ([Int
2], GeneralFlag
Opt_SpecConstr)
, ([Int
2], GeneralFlag
Opt_FastPAPCalls)
]
default_PIC :: Platform -> [GeneralFlag]
default_PIC :: Platform -> [GeneralFlag]
default_PIC Platform
platform =
case (Platform -> OS
platformOS Platform
platform, Platform -> Arch
platformArch Platform
platform) of
(OS
OSDarwin, Arch
ArchX86_64) -> [GeneralFlag
Opt_PIC]
(OS
OSDarwin, Arch
ArchAArch64) -> [GeneralFlag
Opt_PIC]
(OS
OSLinux, Arch
ArchAArch64) -> [GeneralFlag
Opt_PIC, GeneralFlag
Opt_ExternalDynamicRefs]
(OS
OSLinux, ArchARM {}) -> [GeneralFlag
Opt_PIC, GeneralFlag
Opt_ExternalDynamicRefs]
(OS
OSLinux, ArchRISCV64 {}) -> [GeneralFlag
Opt_PIC, GeneralFlag
Opt_ExternalDynamicRefs]
(OS
OSOpenBSD, Arch
ArchX86_64) -> [GeneralFlag
Opt_PIC]
(OS, Arch)
_ -> []
languageExtensions :: Maybe Language -> [LangExt.Extension]
languageExtensions :: Maybe Language -> [Extension]
languageExtensions Maybe Language
Nothing = Maybe Language -> [Extension]
languageExtensions (Language -> Maybe Language
forall a. a -> Maybe a
Just Language
defaultLanguage)
languageExtensions (Just Language
Haskell98)
= [Extension
LangExt.ImplicitPrelude,
Extension
LangExt.StarIsType,
Extension
LangExt.CUSKs,
Extension
LangExt.MonomorphismRestriction,
Extension
LangExt.NPlusKPatterns,
Extension
LangExt.DatatypeContexts,
Extension
LangExt.TraditionalRecordSyntax,
Extension
LangExt.FieldSelectors,
Extension
LangExt.NondecreasingIndentation,
Extension
LangExt.DeepSubsumption,
Extension
LangExt.ListTuplePuns
]
languageExtensions (Just Language
Haskell2010)
= [Extension
LangExt.ImplicitPrelude,
Extension
LangExt.StarIsType,
Extension
LangExt.CUSKs,
Extension
LangExt.MonomorphismRestriction,
Extension
LangExt.DatatypeContexts,
Extension
LangExt.TraditionalRecordSyntax,
Extension
LangExt.EmptyDataDecls,
Extension
LangExt.ForeignFunctionInterface,
Extension
LangExt.PatternGuards,
Extension
LangExt.DoAndIfThenElse,
Extension
LangExt.FieldSelectors,
Extension
LangExt.RelaxedPolyRec,
Extension
LangExt.DeepSubsumption,
Extension
LangExt.ListTuplePuns ]
languageExtensions (Just Language
GHC2021)
= [Extension
LangExt.ImplicitPrelude,
Extension
LangExt.StarIsType,
Extension
LangExt.MonomorphismRestriction,
Extension
LangExt.TraditionalRecordSyntax,
Extension
LangExt.EmptyDataDecls,
Extension
LangExt.ForeignFunctionInterface,
Extension
LangExt.PatternGuards,
Extension
LangExt.DoAndIfThenElse,
Extension
LangExt.FieldSelectors,
Extension
LangExt.RelaxedPolyRec,
Extension
LangExt.ListTuplePuns,
Extension
LangExt.BangPatterns,
Extension
LangExt.BinaryLiterals,
Extension
LangExt.ConstrainedClassMethods,
Extension
LangExt.ConstraintKinds,
Extension
LangExt.DeriveDataTypeable,
Extension
LangExt.DeriveFoldable,
Extension
LangExt.DeriveFunctor,
Extension
LangExt.DeriveGeneric,
Extension
LangExt.DeriveLift,
Extension
LangExt.DeriveTraversable,
Extension
LangExt.EmptyCase,
Extension
LangExt.EmptyDataDeriving,
Extension
LangExt.ExistentialQuantification,
Extension
LangExt.ExplicitForAll,
Extension
LangExt.FlexibleContexts,
Extension
LangExt.FlexibleInstances,
Extension
LangExt.GADTSyntax,
Extension
LangExt.GeneralizedNewtypeDeriving,
Extension
LangExt.HexFloatLiterals,
Extension
LangExt.ImportQualifiedPost,
Extension
LangExt.InstanceSigs,
Extension
LangExt.KindSignatures,
Extension
LangExt.MultiParamTypeClasses,
Extension
LangExt.NamedFieldPuns,
Extension
LangExt.NamedWildCards,
Extension
LangExt.NumericUnderscores,
Extension
LangExt.PolyKinds,
Extension
LangExt.PostfixOperators,
Extension
LangExt.RankNTypes,
Extension
LangExt.ScopedTypeVariables,
Extension
LangExt.StandaloneDeriving,
Extension
LangExt.StandaloneKindSignatures,
Extension
LangExt.TupleSections,
Extension
LangExt.TypeApplications,
Extension
LangExt.TypeOperators,
Extension
LangExt.TypeSynonymInstances]
languageExtensions (Just Language
GHC2024)
= Maybe Language -> [Extension]
languageExtensions (Language -> Maybe Language
forall a. a -> Maybe a
Just Language
GHC2021) [Extension] -> [Extension] -> [Extension]
forall a. [a] -> [a] -> [a]
++
[Extension
LangExt.DataKinds,
Extension
LangExt.DerivingStrategies,
Extension
LangExt.DisambiguateRecordFields,
Extension
LangExt.ExplicitNamespaces,
Extension
LangExt.GADTs,
Extension
LangExt.MonoLocalBinds,
Extension
LangExt.LambdaCase,
Extension
LangExt.RoleAnnotations]
ways :: DynFlags -> Ways
ways :: DynFlags -> Ways
ways DynFlags
dflags
| DynFlags -> Bool
dynamicNow DynFlags
dflags = Way -> Ways -> Ways
addWay Way
WayDyn (DynFlags -> Ways
targetWays_ DynFlags
dflags)
| Bool
otherwise = DynFlags -> Ways
targetWays_ DynFlags
dflags
targetProfile :: DynFlags -> Profile
targetProfile :: DynFlags -> Profile
targetProfile DynFlags
dflags = Platform -> Ways -> Profile
Profile (DynFlags -> Platform
targetPlatform DynFlags
dflags) (DynFlags -> Ways
ways DynFlags
dflags)
programName :: DynFlags -> String
programName :: DynFlags -> String
programName DynFlags
dflags = GhcNameVersion -> String
ghcNameVersion_programName (GhcNameVersion -> String) -> GhcNameVersion -> String
forall a b. (a -> b) -> a -> b
$ DynFlags -> GhcNameVersion
ghcNameVersion DynFlags
dflags
projectVersion :: DynFlags -> String
projectVersion :: DynFlags -> String
projectVersion DynFlags
dflags = GhcNameVersion -> String
ghcNameVersion_projectVersion (DynFlags -> GhcNameVersion
ghcNameVersion DynFlags
dflags)
ghcUsagePath :: DynFlags -> FilePath
ghcUsagePath :: DynFlags -> String
ghcUsagePath DynFlags
dflags = FileSettings -> String
fileSettings_ghcUsagePath (FileSettings -> String) -> FileSettings -> String
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
ghciUsagePath :: DynFlags -> FilePath
ghciUsagePath :: DynFlags -> String
ghciUsagePath DynFlags
dflags = FileSettings -> String
fileSettings_ghciUsagePath (FileSettings -> String) -> FileSettings -> String
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
topDir :: DynFlags -> FilePath
topDir :: DynFlags -> String
topDir DynFlags
dflags = FileSettings -> String
fileSettings_topDir (FileSettings -> String) -> FileSettings -> String
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
toolDir :: DynFlags -> Maybe FilePath
toolDir :: DynFlags -> Maybe String
toolDir DynFlags
dflags = FileSettings -> Maybe String
fileSettings_toolDir (FileSettings -> Maybe String) -> FileSettings -> Maybe String
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
extraGccViaCFlags :: DynFlags -> [String]
DynFlags
dflags = ToolSettings -> [String]
toolSettings_extraGccViaCFlags (ToolSettings -> [String]) -> ToolSettings -> [String]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
globalPackageDatabasePath :: DynFlags -> FilePath
globalPackageDatabasePath :: DynFlags -> String
globalPackageDatabasePath DynFlags
dflags = FileSettings -> String
fileSettings_globalPackageDatabase (FileSettings -> String) -> FileSettings -> String
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
versionedAppDir :: String -> ArchOS -> MaybeT IO FilePath
versionedAppDir :: String -> ArchOS -> MaybeT IO String
versionedAppDir String
appname ArchOS
platform = do
[MaybeT IO String] -> MaybeT IO String
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum ([MaybeT IO String] -> MaybeT IO String)
-> [MaybeT IO String] -> MaybeT IO String
forall a b. (a -> b) -> a -> b
$ (MaybeT IO String -> MaybeT IO String)
-> [MaybeT IO String] -> [MaybeT IO String]
forall a b. (a -> b) -> [a] -> [b]
map (String -> MaybeT IO String
checkIfExists (String -> MaybeT IO String)
-> (MaybeT IO String -> MaybeT IO String)
-> MaybeT IO String
-> MaybeT IO String
forall (m :: * -> *) b c a.
Monad m =>
(b -> m c) -> (a -> m b) -> a -> m c
<=< (String -> String) -> MaybeT IO String -> MaybeT IO String
forall a b. (a -> b) -> MaybeT IO a -> MaybeT IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (String -> String -> String
</> ArchOS -> String
versionedFilePath ArchOS
platform))
[ IO String -> MaybeT IO String
forall a. IO a -> MaybeT IO a
tryMaybeT (IO String -> MaybeT IO String) -> IO String -> MaybeT IO String
forall a b. (a -> b) -> a -> b
$ String -> IO String
getAppUserDataDirectory String
appname
, IO String -> MaybeT IO String
forall a. IO a -> MaybeT IO a
tryMaybeT (IO String -> MaybeT IO String) -> IO String -> MaybeT IO String
forall a b. (a -> b) -> a -> b
$ XdgDirectory -> String -> IO String
getXdgDirectory XdgDirectory
XdgData String
appname
]
where
checkIfExists :: String -> MaybeT IO String
checkIfExists String
dir = IO Bool -> MaybeT IO Bool
forall a. IO a -> MaybeT IO a
tryMaybeT (String -> IO Bool
doesDirectoryExist String
dir) MaybeT IO Bool -> (Bool -> MaybeT IO String) -> MaybeT IO String
forall a b. MaybeT IO a -> (a -> MaybeT IO b) -> MaybeT IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Bool
True -> String -> MaybeT IO String
forall a. a -> MaybeT IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure String
dir
Bool
False -> IO (Maybe String) -> MaybeT IO String
forall (m :: * -> *) a. m (Maybe a) -> MaybeT m a
MaybeT (Maybe String -> IO (Maybe String)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe String
forall a. Maybe a
Nothing)
versionedFilePath :: ArchOS -> FilePath
versionedFilePath :: ArchOS -> String
versionedFilePath ArchOS
platform = ArchOS -> String
uniqueSubdir ArchOS
platform
initSDocContext :: DynFlags -> PprStyle -> SDocContext
initSDocContext :: DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags PprStyle
style = SDC
{ sdocStyle :: PprStyle
sdocStyle = PprStyle
style
, sdocColScheme :: Scheme
sdocColScheme = DynFlags -> Scheme
colScheme DynFlags
dflags
, sdocLastColour :: PprColour
sdocLastColour = PprColour
Col.colReset
, sdocShouldUseColor :: Bool
sdocShouldUseColor = Bool -> OverridingBool -> Bool
overrideWith (DynFlags -> Bool
canUseColor DynFlags
dflags) (DynFlags -> OverridingBool
useColor DynFlags
dflags)
, sdocDefaultDepth :: Int
sdocDefaultDepth = DynFlags -> Int
pprUserLength DynFlags
dflags
, sdocLineLength :: Int
sdocLineLength = DynFlags -> Int
pprCols DynFlags
dflags
, sdocCanUseUnicode :: Bool
sdocCanUseUnicode = DynFlags -> Bool
useUnicode DynFlags
dflags
, sdocPrintErrIndexLinks :: Bool
sdocPrintErrIndexLinks = Bool -> OverridingBool -> Bool
overrideWith (DynFlags -> Bool
canUseErrorLinks DynFlags
dflags) (DynFlags -> OverridingBool
useErrorLinks DynFlags
dflags)
, sdocHexWordLiterals :: Bool
sdocHexWordLiterals = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_HexWordLiterals DynFlags
dflags
, sdocPprDebug :: Bool
sdocPprDebug = DumpFlag -> DynFlags -> Bool
dopt DumpFlag
Opt_D_ppr_debug DynFlags
dflags
, sdocPrintUnicodeSyntax :: Bool
sdocPrintUnicodeSyntax = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintUnicodeSyntax DynFlags
dflags
, sdocPrintCaseAsLet :: Bool
sdocPrintCaseAsLet = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PprCaseAsLet DynFlags
dflags
, sdocPrintTypecheckerElaboration :: Bool
sdocPrintTypecheckerElaboration = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintTypecheckerElaboration DynFlags
dflags
, sdocPrintAxiomIncomps :: Bool
sdocPrintAxiomIncomps = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintAxiomIncomps DynFlags
dflags
, sdocPrintExplicitKinds :: Bool
sdocPrintExplicitKinds = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintExplicitKinds DynFlags
dflags
, sdocPrintExplicitCoercions :: Bool
sdocPrintExplicitCoercions = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintExplicitCoercions DynFlags
dflags
, sdocPrintExplicitRuntimeReps :: Bool
sdocPrintExplicitRuntimeReps = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintExplicitRuntimeReps DynFlags
dflags
, sdocPrintExplicitForalls :: Bool
sdocPrintExplicitForalls = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintExplicitForalls DynFlags
dflags
, sdocPrintPotentialInstances :: Bool
sdocPrintPotentialInstances = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintPotentialInstances DynFlags
dflags
, sdocPrintEqualityRelations :: Bool
sdocPrintEqualityRelations = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintEqualityRelations DynFlags
dflags
, sdocSuppressTicks :: Bool
sdocSuppressTicks = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressTicks DynFlags
dflags
, sdocSuppressTypeSignatures :: Bool
sdocSuppressTypeSignatures = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressTypeSignatures DynFlags
dflags
, sdocSuppressTypeApplications :: Bool
sdocSuppressTypeApplications = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressTypeApplications DynFlags
dflags
, sdocSuppressIdInfo :: Bool
sdocSuppressIdInfo = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressIdInfo DynFlags
dflags
, sdocSuppressCoercions :: Bool
sdocSuppressCoercions = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressCoercions DynFlags
dflags
, sdocSuppressCoercionTypes :: Bool
sdocSuppressCoercionTypes = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressCoercionTypes DynFlags
dflags
, sdocSuppressUnfoldings :: Bool
sdocSuppressUnfoldings = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressUnfoldings DynFlags
dflags
, sdocSuppressVarKinds :: Bool
sdocSuppressVarKinds = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressVarKinds DynFlags
dflags
, sdocSuppressUniques :: Bool
sdocSuppressUniques = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressUniques DynFlags
dflags
, sdocSuppressModulePrefixes :: Bool
sdocSuppressModulePrefixes = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressModulePrefixes DynFlags
dflags
, sdocSuppressStgExts :: Bool
sdocSuppressStgExts = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressStgExts DynFlags
dflags
, sdocSuppressStgReps :: Bool
sdocSuppressStgReps = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressStgReps DynFlags
dflags
, sdocErrorSpans :: Bool
sdocErrorSpans = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_ErrorSpans DynFlags
dflags
, sdocStarIsType :: Bool
sdocStarIsType = Extension -> DynFlags -> Bool
xopt Extension
LangExt.StarIsType DynFlags
dflags
, sdocLinearTypes :: Bool
sdocLinearTypes = Extension -> DynFlags -> Bool
xopt Extension
LangExt.LinearTypes DynFlags
dflags
, sdocListTuplePuns :: Bool
sdocListTuplePuns = Extension -> DynFlags -> Bool
xopt Extension
LangExt.ListTuplePuns DynFlags
dflags
, sdocPrintTypeAbbreviations :: Bool
sdocPrintTypeAbbreviations = Bool
True
, sdocUnitIdForUser :: FastString -> SDoc
sdocUnitIdForUser = FastString -> SDoc
forall doc. IsLine doc => FastString -> doc
ftext
}
initDefaultSDocContext :: DynFlags -> SDocContext
initDefaultSDocContext :: DynFlags -> SDocContext
initDefaultSDocContext DynFlags
dflags = DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags PprStyle
defaultUserStyle
initPromotionTickContext :: DynFlags -> PromotionTickContext
initPromotionTickContext :: DynFlags -> PromotionTickContext
initPromotionTickContext DynFlags
dflags =
PromTickCtx {
ptcListTuplePuns :: Bool
ptcListTuplePuns = Extension -> DynFlags -> Bool
xopt Extension
LangExt.ListTuplePuns DynFlags
dflags,
ptcPrintRedundantPromTicks :: Bool
ptcPrintRedundantPromTicks = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintRedundantPromotionTicks DynFlags
dflags
}
isSse4_1Enabled :: DynFlags -> Bool
isSse4_1Enabled :: DynFlags -> Bool
isSse4_1Enabled DynFlags
dflags = DynFlags -> Maybe SseVersion
sseVersion DynFlags
dflags Maybe SseVersion -> Maybe SseVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= SseVersion -> Maybe SseVersion
forall a. a -> Maybe a
Just SseVersion
SSE4
isSse4_2Enabled :: DynFlags -> Bool
isSse4_2Enabled :: DynFlags -> Bool
isSse4_2Enabled DynFlags
dflags = DynFlags -> Maybe SseVersion
sseVersion DynFlags
dflags Maybe SseVersion -> Maybe SseVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= SseVersion -> Maybe SseVersion
forall a. a -> Maybe a
Just SseVersion
SSE42
isAvxEnabled :: DynFlags -> Bool
isAvxEnabled :: DynFlags -> Bool
isAvxEnabled DynFlags
dflags = DynFlags -> Bool
avx DynFlags
dflags Bool -> Bool -> Bool
|| DynFlags -> Bool
avx2 DynFlags
dflags Bool -> Bool -> Bool
|| DynFlags -> Bool
avx512f DynFlags
dflags
isAvx2Enabled :: DynFlags -> Bool
isAvx2Enabled :: DynFlags -> Bool
isAvx2Enabled DynFlags
dflags = DynFlags -> Bool
avx2 DynFlags
dflags Bool -> Bool -> Bool
|| DynFlags -> Bool
avx512f DynFlags
dflags
isAvx512cdEnabled :: DynFlags -> Bool
isAvx512cdEnabled :: DynFlags -> Bool
isAvx512cdEnabled DynFlags
dflags = DynFlags -> Bool
avx512cd DynFlags
dflags
isAvx512erEnabled :: DynFlags -> Bool
isAvx512erEnabled :: DynFlags -> Bool
isAvx512erEnabled DynFlags
dflags = DynFlags -> Bool
avx512er DynFlags
dflags
isAvx512fEnabled :: DynFlags -> Bool
isAvx512fEnabled :: DynFlags -> Bool
isAvx512fEnabled DynFlags
dflags = DynFlags -> Bool
avx512f DynFlags
dflags
isAvx512pfEnabled :: DynFlags -> Bool
isAvx512pfEnabled :: DynFlags -> Bool
isAvx512pfEnabled DynFlags
dflags = DynFlags -> Bool
avx512pf DynFlags
dflags
isFmaEnabled :: DynFlags -> Bool
isFmaEnabled :: DynFlags -> Bool
isFmaEnabled DynFlags
dflags = DynFlags -> Bool
fma DynFlags
dflags
isBmiEnabled :: DynFlags -> Bool
isBmiEnabled :: DynFlags -> Bool
isBmiEnabled DynFlags
dflags = case Platform -> Arch
platformArch (DynFlags -> Platform
targetPlatform DynFlags
dflags) of
Arch
ArchX86_64 -> DynFlags -> Maybe BmiVersion
bmiVersion DynFlags
dflags Maybe BmiVersion -> Maybe BmiVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI1
Arch
ArchX86 -> DynFlags -> Maybe BmiVersion
bmiVersion DynFlags
dflags Maybe BmiVersion -> Maybe BmiVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI1
Arch
_ -> Bool
False
isBmi2Enabled :: DynFlags -> Bool
isBmi2Enabled :: DynFlags -> Bool
isBmi2Enabled DynFlags
dflags = case Platform -> Arch
platformArch (DynFlags -> Platform
targetPlatform DynFlags
dflags) of
Arch
ArchX86_64 -> DynFlags -> Maybe BmiVersion
bmiVersion DynFlags
dflags Maybe BmiVersion -> Maybe BmiVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI2
Arch
ArchX86 -> DynFlags -> Maybe BmiVersion
bmiVersion DynFlags
dflags Maybe BmiVersion -> Maybe BmiVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI2
Arch
_ -> Bool
False