HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Moduleghc-lib-parser-9.14.1.20251220GHC2021

GHC.Driver.DynFlags

Contents
  1. Dynamic flags and associated configuration types
  2. Manipulating DynFlags
  3. System tool settings and locations
  4. Include specifications
  5. SDoc
  6. Platform features
Synopsis

Dynamic flags and associated configuration types

datadata DumpFlag

Debugging flags

Constructors

Instances3Enum, Eq, Show
  • Enum DumpFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Eq DumpFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Show DumpFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
datadata GeneralFlag

Enumerates the simple on-or-off dynamic flags

Constructors

Instances3Enum, Eq, Show
  • Enum GeneralFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Eq GeneralFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Show GeneralFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
datadata WarningFlag
#

Constructors

Instances5Bounded, Enum, Eq, Ord, Show
  • Bounded WarningFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Enum WarningFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Eq WarningFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Ord WarningFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Show WarningFlagDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags

The reason why a Diagnostic was emitted in the first place. Diagnostic messages are born within GHC with a very precise reason, which can be completely statically-computed (i.e. this is an error or a warning no matter what), or influenced by the specific state of the DynFlags at the moment of the creation of a new Diagnostic. For example, a parsing error is always going to be an error, whereas a 'WarningWithoutFlag Opt_WarnUnusedImports' might turn into an error due to '-Werror' or '-Werror=warn-unused-imports'. Interpreting a DiagnosticReason together with its associated Severity gives us the full picture.

Constructors

Instances3Eq, Show, Outputable
datadata Language
#
Instances7Bounded, Enum, Eq, Show, NFData, Outputable, …
  • Bounded LanguageDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Enum LanguageDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Eq LanguageDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Show LanguageDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • NFData LanguageDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Outputable LanguageDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Binary LanguageDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
datadata ProfAuto

What kind of {-# SCC #-} to add automatically

Constructors

Instances3Enum, Eq, Show
  • Enum ProfAutoDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.ProfAuto
  • Eq ProfAutoDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.ProfAuto
  • Show ProfAutoDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Types.ProfAuto
datadata DynamicTooState
#

Constructors

  • DT_Dont

    Don't try to build dynamic objects too

  • DT_OK

    Will still try to generate dynamic objects

  • DT_Dyn

    Currently generating dynamic objects (in the backend)

Instances3Eq, Ord, Show
datadata OnOff a
#

Constructors

Instances3Eq, Show, Outputable
  • Eq a => Eq (OnOff a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Show a => Show (OnOff a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
  • Outputable a => Outputable (OnOff a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.Flags
datadata DynFlags

Contains not only a collection of GeneralFlags but also a plethora of information relating to the compilation of a single file or GHC session

Constructors

classclass HasDynFlags (m :: Type -> Type) where
#

Methods

Instances9HasDynFlags, …
datadata GhcMode

The GhcMode tells us whether we're doing multi-module compilation (controlled via the GHC API) or one-shot (single-module) compilation. This makes a difference primarily to the GHC.Unit.Finder: in one-shot mode we look for interface files for imported modules, but in multi-module mode we look for source files in order to check whether they need to be recompiled.

Constructors

Instances2Eq, Outputable
  • Eq GhcModeDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.DynFlags
  • Outputable GhcModeDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.DynFlags
datadata PackageArg

We accept flags which make packages visible, but how they select the package varies; this data type reflects what selection criterion is used.

Constructors

Instances3Eq, Show, Outputable
  • Eq PackageArgDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.DynFlags
  • Show PackageArgDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.DynFlags
  • Outputable PackageArgDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Driver.DynFlags
datadata ModRenaming

Represents the renaming that may be associated with an exposed package, e.g. the rns part of -package "foo (rns)".

Here are some example parsings of the package flags (where a string literal is punned to be a ModuleName:

  • -package foo is ModRenaming True []

  • -package foo () is ModRenaming False []

  • -package foo (A) is ModRenaming False [(A, A)]

  • -package foo (A as B) is ModRenaming False [(A, B)]

  • -package foo with (A as B) is ModRenaming True [(A, B)]

Constructors

Instances2Eq, Outputable
datadata Option

When invoking external tools as part of the compilation pipeline, we pass these a sequence of options on the command-line. Rather than just using a list of Strings, we use a type that allows us to distinguish between filepaths and 'other stuff'. The reason for this is that this type gives us a handle on transforming filenames, and filenames only, to whatever format they're expected to be on a particular platform.

Instances1Eq
  • Eq OptionDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.CliOption

The set of flags which affect optimisation for the purposes of recompilation avoidance. Specifically, these include flags which affect code generation but not the semantics of the program.

See Note [Ignoring some flag changes] in GHC.Iface.Recomp.Flags)

Manipulating DynFlags

System tool settings and locations

The directory for this version of ghc in the user's app directory The appdir used to be in ~/.ghc but to respect the XDG specification we want to move it under $XDG_DATA_HOME/ However, old tooling (like cabal) might still write package environments to the old directory, so we prefer that if a subdirectory of ~/.ghc with the correct target and GHC version suffix exists.

i.e. if ~.ghc$UNIQUE_SUBDIR exists we use that otherwise we use $XDG_DATA_HOME/$UNIQUE_SUBDIR

UNIQUE_SUBDIR is typically a combination of the target platform and GHC version

Include specifications

SDoc

Platform features